/* ==========================================================================
   Escritorio 98 — sistema visual (bevels, controles, ventanas, barra de tareas)
   Los colores del "esquema" se redefinen desde JS (Propiedades de Pantalla).
   ========================================================================== */
:root {
  --face: #c0c0c0;
  --light: #dfdfdf;
  --hilite: #ffffff;
  --shadow: #808080;
  --dark: #0a0a0a;
  --title-a1: #000080;
  --title-a2: #1084d0;
  --title-i1: #808080;
  --title-i2: #b5b5b5;
  --title-text: #ffffff;
  --title-itext: #c0c0c0;
  --sel: #000080;
  --sel-text: #ffffff;
  --desktop: #008080;
  --win: #ffffff;
  --text: #000000;
  --tip: #ffffe1;
  --tb-h: 28px;
  --font: "Microsoft Sans Serif", "MS Sans Serif", Tahoma, Geneva, Arial, sans-serif;
  --mono: "VT323", "Fixedsys", "Lucida Console", "Courier New", monospace;

  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--hilite), inset -2px -2px var(--shadow), inset 2px 2px var(--light);
  --raised-win: inset -1px -1px var(--dark), inset 1px 1px var(--light), inset -2px -2px var(--shadow), inset 2px 2px var(--hilite);
  --pressed: inset -1px -1px var(--hilite), inset 1px 1px var(--dark), inset -2px -2px var(--light), inset 2px 2px var(--shadow);
  --sunken: inset -1px -1px var(--hilite), inset 1px 1px var(--shadow), inset -2px -2px var(--light), inset 2px 2px var(--dark);
  --shallow: inset -1px -1px var(--hilite), inset 1px 1px var(--shadow);
  --thin-raised: inset -1px -1px var(--shadow), inset 1px 1px var(--hilite);
  --dither: conic-gradient(var(--hilite) 25%, var(--face) 0 50%, var(--hilite) 0 75%, var(--face) 0) 0 0 / 2px 2px;

  --cur-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='19' shape-rendering='crispEdges'%3E%3Cpath d='M.5.5v15l4-4 3 6.5 2-1-3-6h5z' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E") 0 0, default;
  --cur-wait: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='22' shape-rendering='crispEdges'%3E%3Cpath d='M.5.5h12v2h-1v3l-4 5 4 5v3h1v2H.5v-2h1v-3l4-5-4-5v-3h-1z' fill='%23fff' stroke='%23000'/%3E%3Cpath d='M3 5h7l-3.5 4zM6 13h1l3 5H3z'/%3E%3C/svg%3E") 6 11, wait;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--desktop);
  color: var(--text);
  font: 11px/1.3 var(--font);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  cursor: var(--cur-arrow);
  touch-action: manipulation;
}
html.busy, html.busy * { cursor: var(--cur-wait) !important; }
::selection { background: var(--sel); color: var(--sel-text); }
img { max-width: 100%; }
[hidden] { display: none !important; }
u { text-decoration: underline; text-underline-offset: 1px; }
button, input, select, textarea { font: inherit; color: inherit; cursor: inherit; }
a { cursor: pointer; }

/* ---------- barras de desplazamiento clásicas ---------- */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: var(--dither); }
::-webkit-scrollbar-thumb { background: var(--face); box-shadow: var(--raised-win); }
::-webkit-scrollbar-corner { background: var(--face); }
::-webkit-scrollbar-button:single-button {
  display: block; width: 16px; height: 16px;
  background-color: var(--face); background-repeat: no-repeat; background-position: center;
  box-shadow: var(--raised-win);
}
::-webkit-scrollbar-button:single-button:active { box-shadow: var(--shallow); background-position: calc(50% + 1px) calc(50% + 1px); }
::-webkit-scrollbar-button:vertical:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v1h1v1h1v1h1v1H0V3h1V2h1V1h1z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:vertical:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h7v1H6v1H5v1H4v1H3V3H2V2H1V1H0z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:horizontal:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v7H3V6H2V5H1V4H0V3h1V2h1V1h1z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:horizontal:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1h1v1h1v1h1v1H3v1H2v1H1v1H0z'/%3E%3C/svg%3E"); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-color: var(--face) var(--light); }
}

/* ---------- botones ---------- */
.btn {
  min-width: 75px; min-height: 23px; padding: 0 12px;
  background: var(--face); border: 0; border-radius: 0;
  box-shadow: var(--raised); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; white-space: pre;
}
.btn:active:not(:disabled) { box-shadow: var(--pressed); padding: 2px 11px 0 13px; }
.btn:focus { outline: 1px dotted var(--text); outline-offset: -4px; }
.btn.default {
  box-shadow: inset -2px -2px var(--dark), inset 1px 1px var(--dark), inset 2px 2px var(--hilite),
              inset -3px -3px var(--shadow), inset 3px 3px var(--light);
}
.btn:disabled, .disabled-text { color: var(--shadow); text-shadow: 1px 1px 0 var(--hilite); }
.btn.small { min-width: 0; padding: 0 6px; }

.tbtn {
  background: none; border: 0; padding: 3px; display: inline-flex; flex-direction: column;
  align-items: center; gap: 1px; min-width: 24px; color: var(--text);
}
.tbtn:hover:not(:disabled) { box-shadow: var(--thin-raised); }
.tbtn:active:not(:disabled), .tbtn.on { box-shadow: var(--shallow); }
.tbtn.on { background: var(--dither); }
.tbtn:disabled { filter: grayscale(1) opacity(.5); }
.tbtn img { width: 20px; height: 20px; image-rendering: pixelated; }

/* ---------- campos ---------- */
.field, input[type="text"], input[type="number"], textarea, select {
  background: var(--win); border: 0; border-radius: 0; box-shadow: var(--sunken);
  padding: 3px 4px; min-height: 21px; outline: none;
}
textarea { resize: none; user-select: text; -webkit-user-select: text; font: 12px/1.35 "Fixedsys", "Lucida Console", "Courier New", monospace; }
input[type="text"], input[type="number"] { user-select: text; -webkit-user-select: text; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='17' shape-rendering='crispEdges'%3E%3Cpath fill='%230a0a0a' d='M15 0h1v17H0v-1h15z'/%3E%3Cpath fill='%23fff' d='M1 1h13v1H2v13H1z'/%3E%3Cpath fill='%23808080' d='M14 1h1v15H1v-1h13z'/%3E%3Cpath fill='%23c0c0c0' d='M2 2h12v13H2z'/%3E%3Cpath d='M4 7h7v1h-1v1H9v1H8v1H7v-1H6V9H5V8H4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: top 2px right 2px;
}
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 13px; height: 13px; background: var(--win); box-shadow: var(--sunken);
  background-repeat: no-repeat; background-position: center; outline: none;
}
input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M6 0h1v3H6v1H5v1H4v1H3v1H2V6H1V5H0V2h1v1h1v1h1V3h1V2h1V1h1z'/%3E%3C/svg%3E");
}
input[type="radio"] {
  width: 12px; height: 12px; box-shadow: none; background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' shape-rendering='crispEdges'%3E%3Cpath fill='%23808080' d='M4 0h4v1h2v1H8V1H4v1H2v2H1v4H0V4h1V2h1V1h2z'/%3E%3Cpath fill='%230a0a0a' d='M4 1h4v1h2v1H8V2H4v1H3v1H2v4H1V4h1V3h1V2h1z'/%3E%3Cpath fill='%23dfdfdf' d='M9 3h1v1h1v4h-1v2H8v1H4v-1h4V9h1V8h1V4H9z'/%3E%3Cpath fill='%23fff' d='M10 1h1v2h1v4h-1v2h-1v1H8v1H4v1h4v-1h2v-1h1V9h1V3h-1V2h-1z'/%3E%3Cpath fill='%23fff' d='M4 2h4v1h1v1h1v4H9v1H8v1H4V9H3V8H2V4h1V3h1z'/%3E%3C/svg%3E");
}
input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' shape-rendering='crispEdges'%3E%3Cpath fill='%23808080' d='M4 0h4v1h2v1H8V1H4v1H2v2H1v4H0V4h1V2h1V1h2z'/%3E%3Cpath fill='%230a0a0a' d='M4 1h4v1h2v1H8V2H4v1H3v1H2v4H1V4h1V3h1V2h1z'/%3E%3Cpath fill='%23dfdfdf' d='M9 3h1v1h1v4h-1v2H8v1H4v-1h4V9h1V8h1V4H9z'/%3E%3Cpath fill='%23fff' d='M10 1h1v2h1v4h-1v2h-1v1H8v1H4v1h4v-1h2v-1h1V9h1V3h-1V2h-1z'/%3E%3Cpath fill='%23fff' d='M4 2h4v1h1v1h1v4H9v1H8v1H4V9H3V8H2V4h1V3h1z'/%3E%3Cpath d='M5 4h2v1h1v2H7v1H5V7H4V5h1z'/%3E%3C/svg%3E");
}
.check { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.check:focus-within span { outline: 1px dotted var(--text); }

fieldset {
  border: 1px solid var(--shadow); box-shadow: 1px 1px 0 var(--hilite), inset 1px 1px 0 var(--hilite);
  margin: 0; padding: 10px 10px 8px; min-width: 0;
}
legend { padding: 0 3px; background: var(--face); }

.listbox { background: var(--win); box-shadow: var(--sunken); padding: 2px; overflow: auto; }
.listbox > div { padding: 1px 3px; white-space: nowrap; }
.listbox > div.sel { background: var(--sel); color: var(--sel-text); }
.listbox:focus-within > div.sel { outline: 1px dotted #ff0; outline-offset: -1px; }

.progress { height: 18px; box-shadow: var(--shallow); padding: 2px; background: var(--face); }
.progress > i {
  display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(90deg, var(--sel) 0 8px, transparent 8px 10px);
}

.etched { height: 2px; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--hilite); margin: 4px 0; }
.sunken-panel { background: var(--win); box-shadow: var(--sunken); }

/* ---------- escritorio ---------- */
.desktop {
  position: fixed; inset: 0 0 var(--tb-h) 0; overflow: hidden;
  background-color: var(--desktop); outline: none;
}
.desktop.tb-hidden { bottom: 2px; }
.dicon {
  position: absolute; width: 75px; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding-top: 2px; color: #fff; text-align: center; outline: none;
}
.dicon .ico, .ico { position: relative; width: 32px; height: 32px; display: block; flex: none; }
.ico img { width: 100%; height: 100%; display: block; image-rendering: pixelated; pointer-events: none; }
.ico::after {
  content: ""; position: absolute; inset: 0; display: none;
  background: conic-gradient(var(--sel) 25%, transparent 0 50%, var(--sel) 0 75%, transparent 0) 0 0 / 2px 2px;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.selected > .ico::after { display: block; }
.dicon .lbl { padding: 0 2px 1px; line-height: 13px; max-width: 75px; overflow-wrap: anywhere; }
.dicon.selected .lbl { background: var(--sel); color: var(--sel-text); }
.dicon:focus .lbl { outline: 1px dotted #ffff80; outline-offset: 0; }
.desktop.light-bg .dicon:not(.selected) .lbl { color: #000; }
.dicon.shortcut .ico::before {
  content: ""; position: absolute; left: 0; bottom: 0; width: 11px; height: 11px; z-index: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' shape-rendering='crispEdges'%3E%3Cpath fill='%23fff' d='M0 0h11v11H0z'/%3E%3Cpath d='M0 0h11v11H0zM1 1v9h9V1z' fill-rule='evenodd' fill='%23000'/%3E%3Cpath d='M5 3h4v4H8V5H7v1H6v1H5v1H3V6h1V5h1V4H5z'/%3E%3C/svg%3E");
}
.marquee-sel {
  position: absolute; border: 1px dotted #fff; mix-blend-mode: difference; pointer-events: none; z-index: 1;
}

/* ---------- ventanas ---------- */
.win98 {
  position: absolute; display: flex; flex-direction: column;
  background: var(--face); box-shadow: var(--raised-win); padding: 3px;
  max-width: 100%; outline: none;
}
.win98.maximized { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; }
.win98.maximized .rz { display: none; }
.title-bar {
  display: flex; align-items: center; gap: 3px; height: 18px; flex: none;
  padding: 0 2px 0 2px; font-weight: bold; white-space: nowrap;
  background: linear-gradient(90deg, var(--title-i1), var(--title-i2)); color: var(--title-itext);
}
.win98.active > .title-bar, .title-bar.force-active { background: linear-gradient(90deg, var(--title-a1), var(--title-a2)); color: var(--title-text); }
.title-bar.flash { background: linear-gradient(90deg, var(--title-i1), var(--title-i2)) !important; color: var(--title-itext) !important; }
.title-icon { width: 16px; height: 16px; flex: none; image-rendering: pixelated; }
.title-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-left: 1px; }
.title-controls { display: flex; flex: none; }
.title-controls button {
  width: 16px; height: 14px; padding: 0; border: 0; background-color: var(--face);
  box-shadow: var(--raised); background-repeat: no-repeat;
}
.title-controls button:active { box-shadow: var(--pressed); }
.title-controls [data-act="close"] { margin-left: 2px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v1H0zM6 0h2v1H6zM1 1h2v1H1zM5 1h2v1H5zM2 2h4v1H2zM3 3h2v1H3zM2 4h4v1H2zM1 5h2v1H1zM5 5h2v1H5zM0 6h2v1H0zM6 6h2v1H6z'/%3E%3C/svg%3E"); background-position: 4px 3px; }
.title-controls [data-act="close"]:active { background-position: 5px 4px; }
.title-controls [data-act="min"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='2'%3E%3Crect width='6' height='2'/%3E%3C/svg%3E"); background-position: 4px 9px; }
.title-controls [data-act="min"]:active { background-position: 5px 10px; }
.title-controls [data-act="max"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cpath fill-rule='evenodd' d='M0 0h9v9H0zM1 2v6h7V2z'/%3E%3C/svg%3E"); background-position: 3px 2px; }
.title-controls [data-act="max"]:active { background-position: 4px 3px; }
.win98.maximized [data-act="max"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='9' shape-rendering='crispEdges'%3E%3Cpath d='M2 0h6v6H7V2H3v1H2z'/%3E%3Cpath fill-rule='evenodd' d='M0 3h6v6H0zM1 5v3h4V5z'/%3E%3C/svg%3E"); }
.title-controls [data-act="help"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='9' shape-rendering='crispEdges'%3E%3Cpath d='M1 0h4v1H1zM0 1h2v1H0zM4 1h2v2H4zM3 3h2v1H3zM2 4h2v2H2zM2 7h2v2H2z'/%3E%3C/svg%3E"); background-position: 5px 2px; }
.title-controls button:disabled { opacity: .45; }

.menubar { display: flex; flex-wrap: wrap; padding: 1px 0; flex: none; }
.menubar > button { background: none; border: 0; padding: 1px 6px 2px; }
.menubar > button:hover { box-shadow: var(--thin-raised); }
.menubar > button.open { box-shadow: var(--shallow); padding: 2px 5px 1px 7px; }

.window-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.statusbar { display: flex; gap: 2px; margin-top: 2px; flex: none; }
.statusbar > div { box-shadow: var(--shallow); padding: 2px 4px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 18px; }
.statusbar > div.fixed { flex: 0 0 auto; min-width: 80px; }
.statusbar > .grip {
  flex: 0 0 14px; box-shadow: none; padding: 0; align-self: flex-end;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' shape-rendering='crispEdges'%3E%3Cg fill='%23fff'%3E%3Cpath d='M10 0h1v1h-1zM9 1h1v1H9zM8 2h1v1H8zM7 3h1v1H7zM6 4h1v1H6zM5 5h1v1H5zM4 6h1v1H4zM3 7h1v1H3zM2 8h1v1H2zM1 9h1v1H1zM0 10h1v1H0zM10 4h1v1h-1zM9 5h1v1H9zM8 6h1v1H8zM7 7h1v1H7zM6 8h1v1H6zM5 9h1v1H5zM4 10h1v1H4zM10 8h1v1h-1zM9 9h1v1H9zM8 10h1v1H8z'/%3E%3C/g%3E%3Cg fill='%23808080'%3E%3Cpath d='M11 0h1v2h-1zM10 1h1v2h-1zM9 2h1v2H9zM8 3h1v2H8zM7 4h1v2H7zM6 5h1v2H6zM5 6h1v2H5zM4 7h1v2H4zM3 8h1v2H3zM2 9h1v2H2zM1 10h1v2H1zM11 4h1v2h-1zM10 5h1v2h-1zM9 6h1v2H9zM8 7h1v2H8zM7 8h1v2H7zM6 9h1v2H6zM5 10h1v2H5zM11 8h1v2h-1zM10 9h1v2h-1zM9 10h1v2H9z'/%3E%3C/g%3E%3C/svg%3E") no-repeat right bottom;
}
.rz { position: absolute; z-index: 2; }
.rz.n { top: -2px; left: 6px; right: 6px; height: 6px; cursor: ns-resize; }
.rz.s { bottom: -2px; left: 6px; right: 6px; height: 6px; cursor: ns-resize; }
.rz.e { right: -2px; top: 6px; bottom: 6px; width: 6px; cursor: ew-resize; }
.rz.w { left: -2px; top: 6px; bottom: 6px; width: 6px; cursor: ew-resize; }
.rz.ne { right: -2px; top: -2px; width: 10px; height: 10px; cursor: nesw-resize; }
.rz.nw { left: -2px; top: -2px; width: 10px; height: 10px; cursor: nwse-resize; }
.rz.se { right: -2px; bottom: -2px; width: 14px; height: 14px; cursor: nwse-resize; }
.rz.sw { left: -2px; bottom: -2px; width: 10px; height: 10px; cursor: nesw-resize; }
.modal-cover { position: absolute; inset: 0; z-index: 5; }
.drag-outline {
  position: absolute; pointer-events: none; z-index: 99999;
  border: 3px solid transparent; border-image: conic-gradient(#000 25%, #fff 0 50%, #000 0 75%, #fff 0) 1 / 3px;
  mix-blend-mode: difference;
}
.caption-fly {
  position: fixed; height: 18px; z-index: 99999; pointer-events: none;
  background: linear-gradient(90deg, var(--title-a1), var(--title-a2));
}

/* ---------- menús emergentes ---------- */
.menu {
  position: fixed; z-index: 20000; background: var(--face); box-shadow: var(--raised-win);
  padding: 2px; min-width: 150px; display: flex; outline: none;
}
.menu-list { flex: 1; display: flex; flex-direction: column; }
.menu-item {
  display: grid; grid-template-columns: 18px 1fr auto 16px; align-items: center;
  height: 17px; padding: 0 2px; white-space: nowrap; color: var(--text);
}
.menu-item .mi-short { padding-left: 18px; }
.menu-item.hot { background: var(--sel); color: var(--sel-text); }
.menu-item.disabled { color: var(--shadow); text-shadow: 1px 1px 0 var(--hilite); }
.menu-item.disabled.hot { text-shadow: none; }
.menu-item.default .mi-label { font-weight: bold; }
.mi-check { display: grid; place-items: center; }
.menu-item.checked .mi-check::before {
  content: ""; width: 7px; height: 7px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7'%3E%3Cpath d='M6 0h1v3H6v1H5v1H4v1H3v1H2V6H1V5H0V2h1v1h1v1h1V3h1V2h1V1h1z'/%3E%3C/svg%3E");
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7'%3E%3Cpath d='M6 0h1v3H6v1H5v1H4v1H3v1H2V6H1V5H0V2h1v1h1v1h1V3h1V2h1V1h1z'/%3E%3C/svg%3E");
}
.menu-item.radio .mi-check::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mi-arrow { justify-self: end; margin-right: 2px; }
.menu-item.has-sub .mi-arrow { width: 0; height: 0; border-left: 4px solid currentColor; border-block: 4px solid transparent; }
.menu-sep { height: 2px; margin: 3px 1px; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--hilite); }
.menu.icons .menu-item { height: 22px; grid-template-columns: 26px 1fr auto 16px; }
.menu.icons .mi-check { display: none; }
.menu .mi-icon { width: 16px; height: 16px; justify-self: center; image-rendering: pixelated; }
.menu:not(.icons) .mi-icon { display: none; }
.menu.anim { animation: menu-slide .14s steps(5) both; }
.menu.anim.up { animation-name: menu-slide-up; }
@keyframes menu-slide { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes menu-slide-up { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
.menu-empty { padding: 2px 22px; color: var(--shadow); text-shadow: 1px 1px 0 var(--hilite); }

/* menú Inicio */
.menu.start { padding: 3px; min-width: 0; }
.start-banner {
  width: 21px; flex: none; position: relative; overflow: hidden;
  background: linear-gradient(0deg, #000080, #1084d0);
}
.start-banner span {
  position: absolute; left: 0; bottom: 0; transform-origin: 0 0; transform: rotate(-90deg);
  white-space: nowrap; padding-left: 6px; font: 18px/21px "Arial Black", Arial, sans-serif; color: #c0c0c0; letter-spacing: -0.5px;
}
.start-banner span b { font: bold 18px/21px Arial, sans-serif; color: #fff; }
.menu.start .menu-list { padding-left: 1px; min-width: 170px; }
.menu.start .menu-item { height: 32px; grid-template-columns: 38px 1fr auto 16px; padding-right: 4px; }
.menu.start .mi-icon { width: 32px; height: 32px; }
.menu.start.small-icons .menu-item { height: 22px; grid-template-columns: 26px 1fr auto 16px; }
.menu.start.small-icons .mi-icon { width: 16px; height: 16px; }
.menu.start.small-icons .start-banner { display: none; }

/* ---------- barra de tareas ---------- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000;
  height: calc(var(--tb-h) + env(safe-area-inset-bottom, 0px));
  padding: 4px 2px calc(2px + env(safe-area-inset-bottom, 0px));
  background: var(--face); box-shadow: inset 0 1px var(--face), inset 0 2px var(--hilite);
  display: flex; align-items: center; gap: 3px;
  transition: transform .15s steps(4);
}
.taskbar.autohide:not(.peek) { transform: translateY(calc(100% - 3px)); }
.start-btn {
  height: 22px; padding: 0 5px 0 3px; border: 0; background: var(--face); box-shadow: var(--raised);
  display: flex; align-items: center; gap: 3px; font-weight: bold; flex: none;
}
.start-btn img { width: 16px; height: 16px; image-rendering: pixelated; }
.start-btn.pressed { box-shadow: var(--pressed); padding: 1px 4px 0 4px; }
.start-btn:focus-visible .start-lbl { outline: 1px dotted #000; }
.tb-grip { width: 3px; height: 20px; box-shadow: var(--thin-raised); flex: none; margin-left: 2px; }
.tb-sep { width: 2px; height: 20px; border-left: 1px solid var(--shadow); border-right: 1px solid var(--hilite); flex: none; }
.quick { display: flex; flex: none; }
.quick button { width: 23px; height: 22px; padding: 0; border: 0; background: none; display: grid; place-items: center; }
.quick button:hover { box-shadow: var(--thin-raised); }
.quick button:active { box-shadow: var(--shallow); }
.quick img { width: 16px; height: 16px; image-rendering: pixelated; }
.tasks { flex: 1; min-width: 0; display: flex; gap: 3px; overflow: hidden; }
.task {
  flex: 0 1 160px; min-width: 24px; height: 22px; border: 0; padding: 0 4px;
  background: var(--face); box-shadow: var(--raised);
  display: flex; align-items: center; gap: 3px; text-align: left;
}
.task img { width: 16px; height: 16px; flex: none; image-rendering: pixelated; }
.task span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.task.active { box-shadow: var(--pressed); background: var(--dither); font-weight: bold; padding-top: 1px; }
.task.flash { background: var(--sel); color: var(--sel-text); }
.tray {
  flex: none; height: 22px; display: flex; align-items: center; gap: 4px;
  padding: 0 8px 0 4px; box-shadow: var(--shallow);
}
.tray button { border: 0; background: none; padding: 0; width: 16px; height: 16px; }
.tray img { width: 16px; height: 16px; image-rendering: pixelated; }
.clock { font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

/* ---------- burbuja de ayuda ---------- */
.tooltip {
  position: fixed; z-index: 40000; pointer-events: none;
  background: var(--tip); color: #000; border: 1px solid #000; padding: 1px 4px 2px; white-space: nowrap;
}

/* ---------- cuadros de diálogo ---------- */
.dlg { display: flex; flex-direction: column; gap: 10px; padding: 10px 8px 6px; }
.dlg-msg { display: flex; gap: 14px; align-items: flex-start; padding: 6px 6px 0; max-width: 420px; }
.dlg-msg img { width: 32px; height: 32px; flex: none; image-rendering: pixelated; }
.dlg-msg p { margin: 0; padding-top: 2px; white-space: pre-line; }
.dlg-buttons { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.dlg-buttons.right { justify-content: flex-end; }

/* pestañas de hojas de propiedades */
.tabs { display: flex; padding-left: 2px; position: relative; z-index: 1; flex-wrap: wrap; }
.tab {
  border: 0; padding: 2px 7px 3px; margin-top: 2px; background: var(--face); position: relative;
  box-shadow: inset 1px 1px var(--hilite), inset -1px 0 var(--dark), inset -2px 0 var(--shadow), inset 2px 2px var(--light);
  border-radius: 3px 3px 0 0;
}
.tab.active { margin: 0 -2px -1px; padding: 3px 9px 5px; z-index: 2; }
.tab.active::after { content: ""; position: absolute; left: 1px; right: 2px; bottom: 0; height: 2px; background: var(--face); }
.tab:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.tab-panel { box-shadow: var(--raised-win); padding: 12px 10px 10px; flex: 1; min-height: 0; }

/* ---------- pantallas completas ---------- */
.screen { position: fixed; inset: 0; z-index: 50000; }
.dither-cover {
  position: fixed; inset: 0; z-index: 19000;
  background: conic-gradient(#000 25%, transparent 0 50%, #000 0 75%, transparent 0) 0 0 / 2px 2px;
}

@media (max-width: 520px) {
  .quick, .quick + .tb-sep { display: none; }
  .task { flex-basis: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  .menu.anim { animation: none; }
  .taskbar { transition: none; }
}
