/* Ps · interfaz al estilo Photoshop CS4 (gris oscuro, paneles a la derecha) */
:root {
  --bg: #535353; --bg2: #474747; --bg3: #3c3c3c; --bg4: #2b2b2b;
  --line: #2a2a2a; --line2: #6a6a6a; --txt: #e6e6e6; --txt2: #b5b5b5;
  --sel: #6b6b6b; --acento: #1f5fbf; --activo: #7d7d7d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { font: 12px/1.3 "Segoe UI", Tahoma, Arial, sans-serif; color: var(--txt); background: var(--bg4); user-select: none; }
#app { display: flex; flex-direction: column; height: 100%; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--bg2); border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; cursor: pointer; }
button:hover { background: var(--sel); }
button:active, button.on { background: var(--bg4); border-color: #111; }
input[type=text], input[type=number], select { background: #3a3a3a; border: 1px solid #262626; border-radius: 2px; padding: 2px 4px; }
input[type=number] { width: 52px; }
input[type=range] { vertical-align: middle; }
kbd { background: #333; border: 1px solid #222; border-radius: 3px; padding: 0 4px; font-family: inherit; }
a { color: #8ab4f8; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------------------------------------------------------------- barra */
#appbar { display: flex; align-items: center; height: 28px; background: var(--bg3); border-bottom: 1px solid var(--line); }
#logo { display: flex; align-items: center; gap: 4px; padding: 0 8px; font-weight: 700; color: #c4b5fd; font-size: 14px; }
#menubar { display: flex; flex: 1; height: 100%; }
#menubar .m { padding: 0 9px; line-height: 28px; cursor: default; }
#menubar .m:hover, #menubar .m.on { background: var(--sel); }
#appbar-der { padding: 0 8px; display: flex; gap: 8px; align-items: center; color: var(--txt2); }
#menu-abierto { position: fixed; z-index: 50; background: #f0f0f0; color: #111; border: 1px solid #888; box-shadow: 2px 3px 8px rgba(0,0,0,.5); min-width: 220px; padding: 3px 0; }
#menu-abierto .it { display: flex; justify-content: space-between; padding: 3px 24px 3px 26px; cursor: default; position: relative; }
#menu-abierto .it:hover { background: #3d7cd6; color: #fff; }
#menu-abierto .it.dis { color: #999; }
#menu-abierto .it.dis:hover { background: none; color: #999; }
#menu-abierto .it .at { margin-left: 30px; color: inherit; opacity: .75; }
#menu-abierto .it.check::before { content: '✓'; position: absolute; left: 9px; }
#menu-abierto .it.sub::after { content: '▸'; position: absolute; right: 8px; }
#menu-abierto .sep { border-top: 1px solid #ccc; margin: 3px 1px; }
#menu-abierto .submenu { position: absolute; left: 100%; top: -4px; background: #f0f0f0; color: #111; border: 1px solid #888; box-shadow: 2px 3px 8px rgba(0,0,0,.5); min-width: 200px; padding: 3px 0; display: none; }
#menu-abierto .it:hover > .submenu { display: block; }
#menu-abierto .submenu .it:hover { color: #fff; }

/* ------------------------------------------------------- barra opciones */
#optbar { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; background: var(--bg); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
#optbar .icono { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg3); border: 1px solid var(--line); border-radius: 3px; font-size: 14px; }
#optbar label { display: inline-flex; align-items: center; gap: 4px; color: var(--txt); }
#optbar .sep { width: 1px; height: 22px; background: var(--line2); }
#optbar .modos button { width: 24px; padding: 1px 0; font-size: 13px; }
#optbar .modos button.on { background: #222; }
#optbar .info { color: var(--txt2); }

/* --------------------------------------------------------------- pestañas */
#tabs { display: flex; height: 24px; background: var(--bg3); border-bottom: 1px solid var(--line); padding-left: 4px; }
#tabs .tab { padding: 0 10px; line-height: 23px; border-right: 1px solid var(--line); cursor: default; color: var(--txt2); display: flex; gap: 8px; align-items: center; }
#tabs .tab.on { background: var(--bg); color: var(--txt); }
#tabs .tab .x { opacity: .6; } #tabs .tab .x:hover { opacity: 1; }

/* ---------------------------------------------------------------- centro */
#main { display: flex; flex: 1; min-height: 0; }
#toolbox { width: 42px; background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding-top: 2px; overflow-y: auto; }
#toolbox .t { width: 36px; height: 26px; display: flex; align-items: center; justify-content: center; position: relative; border-radius: 3px; cursor: default; font-size: 15px; }
#toolbox .t:hover { background: var(--sel); }
#toolbox .t.on { background: var(--bg4); }
#toolbox .t.grupo::after { content: ''; position: absolute; right: 2px; bottom: 2px; border: 3px solid transparent; border-right-color: #ddd; border-bottom-color: #ddd; }
#toolbox .sepa { width: 30px; border-top: 1px solid var(--line); margin: 3px 0; }
#colores { position: relative; width: 36px; height: 34px; margin: 6px 0; }
#colores .fg, #colores .bg { position: absolute; width: 20px; height: 20px; border: 1px solid #111; box-shadow: 0 0 0 1px #888; cursor: pointer; }
#colores .fg { left: 2px; top: 1px; z-index: 2; }
#colores .bg { left: 13px; top: 12px; }
#colores .sw { position: absolute; right: 0; top: 0; font-size: 10px; cursor: pointer; }
#colores .def { position: absolute; left: 0; bottom: 0; font-size: 9px; cursor: pointer; }
#toolbox .qm { font-size: 12px; }
#flyout { position: fixed; z-index: 60; background: var(--bg3); border: 1px solid #222; box-shadow: 2px 2px 6px rgba(0,0,0,.6); padding: 2px; }
#flyout .it { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 6px; cursor: default; white-space: nowrap; }
#flyout .it:hover { background: var(--sel); }
#flyout .it.on::before { content: '•'; margin-left: -6px; }
#flyout .it .k { margin-left: auto; color: var(--txt2); }

#viewport { flex: 1; position: relative; background: #282828; overflow: hidden; }
#cv, #ov { position: absolute; left: 0; top: 0; }
#ov { cursor: crosshair; }
#vacio { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--txt2); font-size: 14px; }
#vacio p { margin: 6px 0; }

/* ---------------------------------------------------------------- paneles */
#panels { width: 280px; background: var(--bg); border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; }
.panel { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.panel .tabs { display: flex; background: var(--bg3); }
.panel .tabs span { padding: 4px 10px; cursor: default; color: var(--txt2); border-right: 1px solid var(--line); }
.panel .tabs span.on { background: var(--bg); color: var(--txt); }
.panel .cuerpo { padding: 4px; min-height: 40px; }
.panel .pie { display: flex; gap: 2px; padding: 3px 4px; border-top: 1px solid var(--line); background: var(--bg2); justify-content: flex-end; }
.panel .pie button { padding: 1px 6px; font-size: 12px; }
.fila { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 2px; height: 34px; cursor: default; }
.fila:hover { background: var(--bg2); }
.fila.on { background: var(--activo); }
.fila .ojo { width: 16px; text-align: center; opacity: .9; }
.fila .ojo.off { opacity: .15; }
.fila canvas { border: 1px solid #222; background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0/8px 8px; }
.fila .nombre { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .nombre input { width: 100%; }
.fila .mini { color: var(--txt2); font-size: 11px; }
.fila.hist { height: 22px; }
.fila.hist.futuro { color: var(--txt2); opacity: .6; }
.cabecera { display: flex; align-items: center; gap: 6px; padding: 3px 4px; font-size: 11px; color: var(--txt2); }
.cabecera input[type=number] { width: 48px; }
#p-color .cuerpo { display: flex; gap: 8px; align-items: center; }
#p-color .rango { flex: 1; }
#p-color .rango label { display: flex; align-items: center; gap: 4px; }
#p-color .rango input[type=range] { flex: 1; }
#p-color .prev { width: 36px; height: 36px; border: 1px solid #222; }
#muestras { display: flex; flex-wrap: wrap; gap: 2px; }
#muestras span { width: 16px; height: 16px; border: 1px solid #222; cursor: pointer; }
#p-info .cuerpo { font-family: Consolas, monospace; font-size: 11px; color: var(--txt2); white-space: pre; }

/* --------------------------------------------------------------- estado */
#statusbar { height: 20px; background: var(--bg3); border-top: 1px solid var(--line); display: flex; gap: 14px; align-items: center; padding: 0 8px; font-size: 11px; color: var(--txt2); }
#st-msg { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------- diálogos */
#dialogo-fondo { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
#dialogo { background: #f0f0f0; color: #111; border: 1px solid #666; box-shadow: 0 6px 24px rgba(0,0,0,.6); min-width: 320px; max-width: 560px; }
#dialogo h3 { margin: 0; padding: 6px 10px; background: #dcdcdc; border-bottom: 1px solid #aaa; font-size: 13px; }
#dialogo .campos { padding: 10px 14px; display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; }
#dialogo .campos .ancho { grid-column: 1 / -1; }
#dialogo input[type=text], #dialogo input[type=number], #dialogo select { background: #fff; color: #111; border: 1px solid #999; padding: 3px 4px; }
#dialogo input[type=number] { width: 80px; }
#dialogo textarea { grid-column: 1 / -1; width: 100%; height: 120px; font: 12px Consolas, monospace; }
#dialogo .botones { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 14px; border-top: 1px solid #ccc; }
#dialogo .botones button { background: #fafafa; color: #111; border: 1px solid #888; padding: 4px 16px; min-width: 80px; }
#dialogo .botones button.ok { border-color: #2d6bd0; }
#dialogo .nota { grid-column: 1 / -1; color: #555; font-size: 11px; }
#dialogo .rango { display: flex; align-items: center; gap: 6px; }
#dialogo .rango input[type=range] { flex: 1; }
#dialogo .rango output { width: 42px; text-align: right; font-family: Consolas, monospace; }
#toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: #111; color: #fff; padding: 6px 14px; border-radius: 4px; z-index: 200; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
#texto-edit { position: absolute; z-index: 20; background: transparent; border: 1px dashed #888; color: transparent; caret-color: #000; resize: none; overflow: hidden; outline: none; padding: 0; margin: 0; }

body.sin-paneles #panels, body.sin-paneles #toolbox, body.sin-paneles #optbar { display: none; }
body.pantalla-completa #appbar, body.pantalla-completa #tabs, body.pantalla-completa #statusbar { display: none; }
