/* Editor de bocetos — ver docs/editor_rediseno.md.
   Neutros cálidos con sesgo al bordo de La Anónima; azul solo para la selección. */

:root {
  --bg: #f5f2f1;
  --surface: #ffffff;
  --surface-2: #faf8f7;
  --well: #ebe6e4;
  --ink: #1f1a19;
  --muted: #6d6462;
  --line: #e4dedc;
  --line-strong: #d3cbc8;
  --accent: #8b1a1a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e7e5;
  --sel: #2563eb;
  --sel-soft: rgba(37, 99, 235, 0.12);
  --good: #1b7f3b;
  --bad: #b3261e;
  --shadow: 0 1px 2px rgba(40, 20, 15, 0.06), 0 8px 24px rgba(40, 20, 15, 0.1);
  --f-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131010; --surface: #1c1817; --surface-2: #221d1c; --well: #0e0c0b;
    --ink: #f1ebe9; --muted: #a59b98; --line: #322b29; --line-strong: #463d3a;
    --accent: #d9534a; --accent-ink: #1a0d0c; --accent-soft: #3a1c1a;
    --sel: #5b8dff; --sel-soft: rgba(91, 141, 255, 0.16); --good: #4cc27a; --bad: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.45 var(--f-ui); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
.mono { font-family: var(--f-mono); }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600;
  font-size: 13px; cursor: pointer; white-space: nowrap; user-select: none; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--well); }
.btn.icon { width: 32px; padding: 0; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon.sm { width: 28px; padding: 0; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.btn.ghost:disabled:hover { background: transparent; }
.btn.danger:hover { color: var(--bad); }
.btn .count { font-family: var(--f-mono); font-weight: 500; color: var(--muted); font-size: 11.5px; }
.input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
.input:focus { outline: none; border-color: var(--sel); box-shadow: 0 0 0 3px var(--sel-soft); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; background: var(--well); font-size: 12px; white-space: nowrap; }
.chip .mono { color: var(--muted); }

/* ---------------------------------------------------------------- layout */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 296px;
  grid-template-rows: 52px minmax(0, 1fr) 28px;
  background: var(--surface);
}
.app.view-files { grid-template-columns: minmax(0, 1fr); }
.app.view-files .editor-only { display: none !important; }

/* ---------------------------------------------------------------- barra superior */
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; padding-right: 10px; border-right: 1px solid var(--line); height: 28px; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 13px; }
.proj-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; font-weight: 600; font-size: 14px; cursor: pointer; max-width: 280px; }
.proj-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-btn:hover { background: var(--well); }
.save-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; border: none; background: none; padding: 4px 6px; border-radius: var(--r-sm); cursor: default; }
.save-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.save-pill.saving .dot { background: var(--muted); animation: pulse 0.8s infinite alternate; }
.save-pill.error { color: var(--bad); cursor: pointer; }
.save-pill.error .dot { background: var(--bad); }
.save-pill.error:hover { background: var(--well); }
@keyframes pulse { to { opacity: 0.3; } }
.views { display: flex; padding: 2px; background: var(--well); border-radius: var(--r-sm); gap: 2px; margin-left: 6px; }
.views button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: none; background: transparent; border-radius: 5px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.views button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.tb-group { display: flex; align-items: center; gap: 2px; padding: 0 6px; border-left: 1px solid var(--line); height: 28px; }
.zoom-val { font-family: var(--f-mono); font-size: 12px; width: 52px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 12.5px; padding: 0 4px; white-space: nowrap; }
.switch input { appearance: none; width: 30px; height: 18px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background 0.15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch input:checked { background: var(--sel); }
.switch input:checked::after { transform: translateX(12px); }
.avatar { width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; cursor: pointer; margin-left: 4px; }

.menu-anchor { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 6px; }
.topbar > .menu-anchor:last-child .menu, .export-menu { left: auto; right: 0; }
.menu > button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: none; background: none; border-radius: var(--r-sm); cursor: pointer; text-align: left; font-size: 13px; }
.menu > button:hover { background: var(--well); }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-note { color: var(--muted); font-size: 11.5px; padding: 4px 10px; margin: 0; word-break: break-all; }
.export-menu { width: 320px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.export-menu .menu-note { padding: 0; word-break: normal; }

/* ---------------------------------------------------------------- panel de capas */
.left { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.pane-title { display: flex; align-items: center; justify-content: space-between; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 14px 14px 6px; }
.pane { flex: 1; overflow-y: auto; padding: 0 8px 8px; min-height: 0; }
.add-row { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.add-row .btn { flex: 1; }
.layer-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent; }
.layer-row:hover { background: var(--surface-2); }
.layer-row.selected { background: var(--sel-soft); border-color: color-mix(in srgb, var(--sel) 35%, transparent); }
.layer-row.off .layer-name, .layer-row.off .thumb { opacity: 0.45; }
.layer-row.bg-row { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); padding-top: 9px; }
.thumb { width: 36px; height: 28px; border-radius: 4px; flex: none; display: grid; place-items: center; overflow: hidden; color: var(--muted);
  background: repeating-conic-gradient(var(--line) 0 25%, var(--surface-2) 0 50%) 0 0 / 8px 8px; border: 1px solid var(--line); }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb.solid { background: var(--well); }
.layer-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.layer-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-name span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-act { width: 24px; height: 24px; border: none; background: none; border-radius: 4px; display: grid; place-items: center; cursor: pointer; color: var(--muted); opacity: 0; flex: none; }
.layer-row:hover .row-act, .row-act.on { opacity: 1; }
.row-act:hover { background: var(--well); color: var(--ink); }

/* ---------------------------------------------------------------- lienzo */
.center { position: relative; overflow: auto; min-height: 0; display: flex;
  background: var(--well) radial-gradient(color-mix(in srgb, var(--muted) 22%, transparent) 1px, transparent 1px) 0 0 / 16px 16px; }
.stage-box { margin: auto; padding: 52px 40px 44px; }
.stage { position: relative; background: #000; box-shadow: 0 2px 14px rgba(0, 0, 0, 0.28); overflow: visible; }
.stage-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; }
.stage-inner .bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.vis { position: absolute; overflow: hidden; pointer-events: none; }
.vis img { width: 100%; height: 100%; display: block; }
.vis .txt { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 4px; line-height: 1.12; white-space: normal; overflow-wrap: anywhere; }
.vis .panel-blank { position: absolute; inset: 0; background: #fff; }
.vis .panel-txt { position: absolute; inset: 0; padding: 4px; color: #1e1e1e; font-weight: 700; display: flex; align-items: center; }
.render-img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hit-layer { position: absolute; inset: 0; }
.hit { position: absolute; cursor: move; }
.hit:hover { outline: 1px solid var(--sel); }
.hit.locked { cursor: default; }
.preview-mode .hit:hover { outline: none; }
.preview-mode .hit { cursor: default; }

.sel { position: absolute; border: 1.5px solid var(--sel); pointer-events: none; z-index: 5; }
.sel .h { position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid var(--sel); border-radius: 2px; pointer-events: auto; }
.sel .h.nw { left: -6px; top: -6px; cursor: nwse-resize; } .sel .h.n { left: calc(50% - 5px); top: -6px; cursor: ns-resize; }
.sel .h.ne { right: -6px; top: -6px; cursor: nesw-resize; } .sel .h.e { right: -6px; top: calc(50% - 5px); cursor: ew-resize; }
.sel .h.se { right: -6px; bottom: -6px; cursor: nwse-resize; } .sel .h.s { left: calc(50% - 5px); bottom: -6px; cursor: ns-resize; }
.sel .h.sw { left: -6px; bottom: -6px; cursor: nesw-resize; } .sel .h.w { left: -6px; top: calc(50% - 5px); cursor: ew-resize; }
.sel.is-locked .h { display: none; }
.sel.is-locked { border-style: dashed; }
.size-badge { position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); background: var(--sel); color: #fff; font: 500 11px var(--f-mono); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.floatbar { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); pointer-events: auto; white-space: nowrap; }
.floatbar .sep { width: 1px; background: var(--line); margin: 4px 2px; }
.floatbar [data-act="lock"][aria-pressed="true"] { color: var(--sel); }
.sel.near-top .floatbar { bottom: auto; top: calc(100% + 34px); }
.guide { position: absolute; background: #ff3d7f; pointer-events: none; z-index: 6; }
.guide.v { width: 1px; top: 0; bottom: 0; } .guide.h { height: 1px; left: 0; right: 0; }
.empty-stage { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- inspector */
.right { border-left: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; min-height: 0; min-width: 0; }
.insp-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.insp-head .thumb { width: 42px; height: 34px; }
.insp-title { flex: 1; min-width: 0; }
.insp-title b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.insp-title input { width: 100%; font: 600 14px var(--f-ui); background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); padding: 3px 6px; }
.insp-title input:hover { border-color: var(--line); }
.insp-title input:focus { border-color: var(--sel); outline: none; }
.insp-kind { font-size: 11px; color: var(--muted); padding: 0 6px; }
.sec { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.sec-title { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.hint { margin: 0; font-size: 11.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.num { display: flex; align-items: center; height: 32px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.num:focus-within { border-color: var(--sel); box-shadow: 0 0 0 3px var(--sel-soft); }
.num span { width: 26px; text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; flex: none; cursor: ew-resize; user-select: none; }
.num input { width: 100%; min-width: 0; border: none; outline: none; background: transparent; font: 500 12.5px var(--f-mono); padding-right: 6px; }
.ratio-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; }
.link-btn { width: 28px; height: 28px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.link-btn[aria-pressed="true"] { color: var(--sel); background: var(--sel-soft); }
.seg { display: flex; padding: 2px; background: var(--well); border-radius: var(--r-sm); gap: 2px; }
.seg button { flex: 1; height: 28px; border: none; background: transparent; border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; padding: 0 8px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.align-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.align-row button { height: 30px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.align-row button:hover { color: var(--ink); border-color: var(--muted); }
.img-card { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-md); }
.img-card .thumb { width: 64px; height: 48px; }
.img-card div { flex: 1; min-width: 0; }
.img-card b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-card small { color: var(--muted); font-size: 11.5px; font-family: var(--f-mono); }
.ta { width: 100%; min-height: 58px; resize: vertical; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px; background: var(--surface); }
.ta:focus { outline: none; border-color: var(--sel); box-shadow: 0 0 0 3px var(--sel-soft); }
.select { position: relative; }
.select > button { width: 100%; height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; font-size: 14px; }
.select > button:hover { border-color: var(--muted); }
.select > button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select .menu { left: 0; right: 0; min-width: 0; max-height: 300px; overflow-y: auto; }
.select .menu > button { font-size: 15px; }
.select .menu > button[aria-selected="true"] { background: var(--sel-soft); }
.stepper { display: flex; align-items: center; height: 32px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 30px; height: 100%; border: none; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.stepper button:hover { background: var(--well); color: var(--ink); }
.stepper input { flex: 1; min-width: 0; text-align: center; border: none; outline: none; background: transparent; font: 500 12.5px var(--f-mono); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sw { width: 24px; height: 24px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent); cursor: pointer; padding: 0; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sel); }
.sw-custom { width: 24px; height: 24px; border-radius: 50%; overflow: hidden; border: 1px dashed var(--muted); display: grid; place-items: center; position: relative; color: var(--muted); cursor: pointer; }
.sw-custom.on { border-style: solid; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sel); }
.sw-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.grad-prev { height: 22px; border-radius: 5px; border: 1px solid var(--line); }
.empty-insp { padding: 16px 14px; color: var(--muted); font-size: 12.5px; }
.bg-card img { width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line); display: block; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- barra de estado */
.statusbar { grid-column: 1 / -1; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 12px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
#status.error { color: var(--bad); font-weight: 600; }
#render-status.stale { opacity: 0.6; }

/* ---------------------------------------------------------------- archivos */
.files-view { grid-column: 1 / -1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.files-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.files-head .seg button { flex: none; padding: 0 12px; font-family: var(--f-mono); }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-family: var(--f-mono); font-size: 12.5px; }
.crumbs button { border: none; background: none; padding: 3px 5px; border-radius: 4px; cursor: pointer; color: var(--muted); }
.crumbs button:hover { background: var(--well); color: var(--ink); }
.crumbs button:last-child { color: var(--ink); font-weight: 600; }
.crumbs .slash { color: var(--line-strong); }
.upload-zone { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); color: var(--muted); }
.upload-zone.dragover { border-color: var(--sel); background: var(--sel-soft); color: var(--sel); }
.upload-status { margin-left: auto; font-weight: 600; }
.upload-status.error { color: var(--bad); }
.files-grid, .picker-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.file-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); min-width: 0; }
.file-card.clickable { cursor: pointer; }
.file-card.clickable:hover { border-color: var(--sel); }
.file-card .fimg { height: 96px; border-radius: 6px; display: grid; place-items: center; overflow: hidden; color: var(--muted);
  background: repeating-conic-gradient(var(--line) 0 25%, var(--surface-2) 0 50%) 0 0 / 10px 10px; }
.file-card .fimg img { max-width: 100%; max-height: 100%; object-fit: contain; }
.file-card .fimg svg { width: 30px; height: 30px; }
.file-card .fname { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .fmeta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11.5px; }
.file-card a { color: var(--muted); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 4px; }
.file-card a:hover { background: var(--well); color: var(--ink); }
.folder-chips, .picker-folders { display: flex; flex-wrap: wrap; gap: 6px; }
.folder-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 12.5px; }
.folder-chip:hover { border-color: var(--sel); color: var(--sel); }
.files-empty { color: var(--muted); padding: 12px 2px; }

/* ---------------------------------------------------------------- modales y avisos */
.modal { border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(20, 12, 10, 0.45); }
.picker { width: min(920px, calc(100vw - 32px)); height: min(640px, calc(100vh - 48px)); }
.picker[open] { display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.picker-folders { padding: 12px 14px 0; }
.picker-folders:empty { display: none; }
.picker-body { padding: 14px; overflow-y: auto; flex: 1; align-content: start; }
.ask { width: min(440px, calc(100vw - 32px)); }
.ask form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ask h2 { margin: 0; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 9px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; z-index: 100; box-shadow: var(--shadow); max-width: min(560px, calc(100vw - 32px)); }
.toast.error { background: var(--bad); color: #fff; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- login / restablecer contraseña */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 24px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 14px;
}
.auth-card[hidden] { display: none; }
.auth-card h1 { margin: 0 0 4px; font-size: 19px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.auth-card input { height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 14px; background: var(--surface); color: var(--ink); }
.auth-card input:focus { outline: none; border-color: var(--sel); box-shadow: 0 0 0 3px var(--sel-soft); }
.auth-card button[type="submit"] { height: 38px; border: none; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.auth-card button[type="submit"]:disabled { opacity: 0.6; cursor: default; }
.auth-help { margin: 0; color: var(--muted); font-size: 12px; }
.auth-msg { margin: 0; min-height: 1em; color: var(--bad); font-size: 13px; }
.auth-msg.ok { color: var(--good); }
.auth-link { align-self: center; border: none; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }
