/* Estilos por widget + panel de ajustes + spotlight. */

/* --------------------------------- reloj --------------------------------- */

.clock {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.clock__time {
  font-size: clamp(34px, 4.6vw, 76px); /* respaldo; las reglas por tamaño mandan */
  font-weight: 200;
  letter-spacing: -.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.widget[data-size="sm"] .clock__time { font-size: 38px; }
.widget[data-size="md"] .clock__time { font-size: 54px; }
.widget[data-size="lg"] .clock__time { font-size: 72px; }
.clock__date { color: var(--text-muted); margin-top: 6px; }
.clock__date::first-letter { text-transform: uppercase; }
.clock__greeting { color: var(--text-faint); font-size: 13px; margin-top: 2px; }
.widget[data-size="sm"] .clock__greeting { display: none; }

/* --------------------------------- clima --------------------------------- */

.weather { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.weather__place {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}
.weather__place span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weather__head { display: flex; align-items: center; gap: 14px; }
.weather__glyph { color: var(--text); opacity: .92; flex: none; }
.weather__dayglyph { color: var(--text-muted); display: flex; justify-content: center; }
.weather__temp {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 280; letter-spacing: -.028em; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.weather__label { font-size: 13px; color: var(--text-muted); }
.weather__meta {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  font-size: 12.5px; color: var(--text-muted); margin-top: 2px;
}
.weather__forecast {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--border); padding-top: 8px;
}
.weather__day {
  display: grid; grid-template-columns: 42px 24px 1fr auto;
  align-items: center; gap: 8px; font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 2px 0;
}
.weather__foot { margin-top: auto; font-size: 11.5px; }
/* estado vacío dentro de la tarjeta */
.weather__empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; text-align: center;
}
.weather__empty .weather__glyph { opacity: .5; }

/* lista de ciudades: vive en el diálogo, donde hay sitio de sobra */
.weather__results {
  list-style: none; margin: 0 0 14px; padding: 0;
  display: flex; flex-direction: column; gap: 2px;
  max-height: 240px; overflow: auto;
}
.weather__result {
  width: 100%; text-align: left;
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; color: inherit;
}
.weather__result:hover { background: rgba(127, 127, 127, .18); }
.weather__result-name { font-size: 13.5px; font-weight: 500; }
.weather__result-where { font-size: 11.5px; }
.weather__loading, .weather__error { margin: auto 0; color: var(--text-muted); font-size: 13px; }
.weather__error { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* --------------------------------- notas --------------------------------- */

.notes { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.notes__area {
  flex: 1;
  width: 100%;
  min-height: 0;
  resize: none;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -.003em;
  color: var(--text);
  padding: 0;
  font-family: inherit;
}
.notes__area::placeholder { color: var(--text-faint); }
.notes__foot { height: 16px; }
.notes__status { font-size: 11px; }

/* -------------------------------- temporizador -------------------------------- */

.timer { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 0; }
.timer__dial { position: relative; width: min(100%, 128px); aspect-ratio: 1; flex: none; }
.widget[data-size="sm"] .timer__dial { width: min(100%, 104px); }
.timer__ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer__track { stroke: var(--glass-edge-soft); }
.timer__progress {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset .3s linear;
}
.timer.is-break .timer__progress { stroke: var(--ok); }
.timer__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.timer__time {
  font-family: var(--font-display);
  font-size: 27px; font-weight: 300;
  font-variant-numeric: tabular-nums; letter-spacing: -.025em;
}
.timer__phase { font-size: 11px; font-weight: 550; letter-spacing: .04em; color: var(--text-faint); }
.timer__controls { display: flex; align-items: center; gap: 6px; }
.timer__play { padding: 6px 14px; font-size: 13px; }
.timer__count { font-size: 11.5px; }
.timer.is-done { animation: pulse 1.2s var(--ease) 2; }
@keyframes pulse { 50% { transform: scale(1.03); } }

/* -------------------------------- accesos -------------------------------- */

.shortcuts-wrap { flex: 1; min-height: 0; overflow: auto; }
.shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 6px;
}
.shortcut {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s var(--ease), transform .1s var(--ease);
}
.shortcut:hover { background: var(--surface-hover); }
.shortcut:active { transform: scale(.96); }
.shortcut__title {
  font-size: 11.5px;
  font-weight: 450;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}
.shortcut__remove {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px;
  opacity: 0;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}
.shortcut:hover .shortcut__remove { opacity: 1; }

.favicon {
  position: relative;
  width: 32px; height: 32px;
  border-radius: 24%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: hsl(var(--fav-hue, 250) 62% 52%);
  color: #fff;
  flex: none;
}
.favicon__tile { font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.favicon__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  /* Los apple-touch-icon están pensados para ir a sangre (iOS los recorta en
     squircle), así que el icono llena la tesela: nada de márgenes blancos. El
     redondeo lo aporta el `overflow: hidden` del contenedor. */
  object-fit: cover;
  padding: 0;
  background: transparent;
  opacity: 0;
  transition: opacity .18s var(--ease);
}
.favicon.has-img .favicon__img { opacity: 1; }
.favicon.has-img { background: transparent; }
.favicon.has-img .favicon__tile { opacity: 0; }

/* Excepción: un icono más pequeño que la tesela no puede llenarla sin
   emborronarse. Ese sí se centra a tamaño real sobre un lienzo claro. */
.favicon.is-small { background: #fff; }
.favicon.has-img.is-small { background: #fff; }
.favicon.is-small .favicon__img { object-fit: contain; }
.favicon--add { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-faint); }
.shortcut--add .shortcut__title { color: var(--text-faint); }

.shortcut-form { display: flex; flex-direction: column; gap: 2px; padding: 4px; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------- rss ---------------------------------- */

.rss { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.rss__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rss__title { font-size: 13px; font-weight: 590; letter-spacing: -.008em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rss__list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow: auto; }
.rss__item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 9px;
  border-radius: 11px;
  text-decoration: none;
  color: inherit;
}
.rss__item:hover { background: var(--surface-hover); }
.rss__item-title { font-size: 13.5px; line-height: 1.38; letter-spacing: -.006em; }
.rss__item-summary {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rss__item-meta { font-size: 11px; }
.rss__foot { font-size: 11.5px; }
.rss__setup { display: flex; flex-direction: column; gap: 8px; margin: auto 0; }
.rss__error { display: flex; flex-direction: column; gap: 8px; margin: auto 0; font-size: 13px; }

/* --------------------------- overlay / spotlight --------------------------- */

.overlay {
  position: fixed; inset: 0;
  z-index: 1000;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  animation: fade .16s var(--ease);
}
.overlay--right { align-items: stretch; justify-content: flex-end; padding: 0; }
/* `display: flex` gana al [hidden] de la hoja del navegador: sin esta regla el
   overlay se queda encima de la página capturando clics. */
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
body.modal-open { overflow: hidden; }

.spotlight {
  width: min(620px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: var(--panel-bg);
  backdrop-filter: blur(var(--panel-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
  overflow: hidden;
  animation: pop .18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }

.spotlight__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
}
.spotlight__input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 16px; color: var(--text);
}
/* lista de resultados: compartida por la barra grande y el overlay */
.sresults { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.sresult {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border-radius: 12px;
  cursor: pointer;
}
.sresult.is-active { background: rgba(var(--accent-rgb), .15); }
.sresult__glyph {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--text-muted);
  flex: none;
}
.sresult__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sresult__title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sresult__sub { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sresult__kind { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; flex: none; }
.sresult__empty { padding: 22px; text-align: center; list-style: none; }
.spotlight__hint {
  display: flex; gap: 14px; justify-content: center;
  padding: 8px; border-top: 1px solid var(--border); font-size: 11.5px;
}

/* ------------------------------ panel ajustes ------------------------------
   Tarjeta flotante centrada, no un cajón lateral: se posa sobre el escritorio
   como una lámina de cristal más. */

.overlay--center { align-items: center; justify-content: center; padding: 5vh 16px; }

.panel {
  width: min(680px, 100%);
  max-height: min(84vh, 780px);
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(var(--panel-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: scale(.97) translateY(8px);
  transition: opacity .2s var(--ease), transform .24s var(--ease-spring);
}
.panel.is-open { opacity: 1; transform: none; }

/* `flex: none` en cabecera y pestañas: son items de la columna del panel y, al
   desbordar el contenido, flexbox les robaba altura —el botón activo quedaba de
   15 px con 14 px de relleno, así que su píldora salía descuadrada del texto—.
   El único que debe ceder y desplazarse es el cuerpo. */
.panel__head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 12px;
}
.panel__head h2 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600; letter-spacing: -.02em;
}
.panel__tabs {
  flex: none;
  display: flex; align-items: center; gap: 4px;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--glass-edge-soft);
  overflow-x: auto;
}
.panel__tab {
  flex: none;
  display: inline-flex; align-items: center;
  padding: 7px 14px;
  border: 0; border-radius: 999px;
  background: transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  line-height: 1.25;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.panel__tab:hover { background: var(--surface-hover); color: var(--text); }
.panel__tab.is-active {
  background: rgba(var(--accent-rgb), .18);
  color: var(--text);
}
.panel__body { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px 22px; }
.panel__section { display: flex; flex-direction: column; }
.panel__h3 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 650;
  color: var(--text-faint); margin-bottom: 12px;
}
.sep { border: 0; border-top: 1px solid var(--glass-edge-soft); margin: 20px 0; }

.segmented { display: flex; gap: 4px; padding: 3px; background: var(--surface-hover); border-radius: 10px; }
.segmented__btn {
  flex: 1; padding: 6px 8px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; font-size: 13px; color: var(--text-muted);
}
.segmented__btn.is-active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }

.range { width: 100%; accent-color: var(--accent); }

.wp-preview {
  height: 110px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  display: grid; place-items: center;
  color: var(--text-faint);
  font-size: 13px;
  margin-bottom: 10px;
}
.wp-preview.is-empty { background: var(--surface-hover); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.gallery__item {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--border); border-radius: 12px;
  background: transparent; cursor: pointer; text-align: left;
}
.gallery__item:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.gallery__glyph { color: var(--text-muted); display: flex; }
.gallery__name { font-size: 13.5px; font-weight: 500; }
.gallery__desc { font-size: 11.5px; line-height: 1.35; }

.wlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wlist__item {
  display: grid; grid-template-columns: 22px 1fr auto auto;
  align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 9px;
}
.wlist__item:hover { background: var(--surface-hover); }

.accordion { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.accordion summary { cursor: pointer; font-size: 13.5px; font-weight: 500; }
.accordion[open] summary { margin-bottom: 10px; }

.notice {
  padding: 12px; border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  font-size: 13px;
  margin-bottom: 12px;
}
.notice p + p { margin-top: 6px; }
.notice--ok { border-color: rgba(31, 157, 99, .3); }
.ok { color: var(--ok); }

.caps { list-style: none; margin: 0 0 8px; padding: 0; font-family: var(--mono); font-size: 12px; }
.caps li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--border); }

.boot-error { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* La UI aparece cuando el store ya resolvió: evita ver widgets vacíos. */
.app { opacity: 0; transition: opacity .18s var(--ease); }
body.is-ready .app { opacity: 1; }

@media (max-width: 620px) {
  .panel { width: 100%; max-height: 88vh; border-radius: 22px; }
  .overlay { padding-top: 6vh; }
  .overlay--center { padding: 3vh 10px; }
}

/* ============================ icono de app ============================ */

.widget--bare {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible;
  cursor: grab;
  touch-action: none;
}
.widget--bare::before { display: none; }
.widget--bare:active { cursor: grabbing; }
.widget--bare .widget__body { padding: 4px; }
.widget--bare .widget__resize { display: none; }
.widget--bare[data-size="sm"] .widget__resize { display: block; }

.widget__float {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 3;
  display: flex;
  gap: 2px;
  opacity: 0;
  transform: scale(.8);
  transition: opacity .14s var(--ease), transform .14s var(--ease);
}
.widget--bare:hover .widget__float,
.widget--bare:focus-within .widget__float { opacity: 1; transform: none; }
.widget__float .icon-btn {
  width: 22px; height: 22px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.appicon { flex: 1; display: flex; min-height: 0; }
.appicon__tile {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform .14s var(--ease);
}
.appicon__tile:hover { transform: translateY(-2px); }
.appicon__tile:active { transform: scale(.94); }
.appicon__tile .favicon {
  border-radius: 22%;                     /* esquinas tipo icono de app */
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.appicon__label {
  font-size: 11.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: var(--text-muted);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.has-wallpaper .appicon__label { color: var(--text); }
.appicon__form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  padding: 6px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.input--sm { padding: 5px 7px; font-size: 12px; border-radius: 8px; }

/* ================================ dock ================================ */

.dock {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 800;
  padding-top: 46px;          /* espacio para que los iconos crezcan sin recorte */
  pointer-events: none;
}
.dock[hidden] { display: none; }
.dock__glass {
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  padding: 7px 10px;
  border-radius: 22px;
  border: 1px solid var(--glass-edge-soft);
  background: rgba(var(--glass-tint), calc(var(--glass-alpha) * .9));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 -1px 0 var(--glass-edge-soft),
    0 10px 40px rgba(0, 0, 0, .32);
}
.dock__list { display: flex; align-items: flex-end; gap: 6px; }

.dock__item {
  --mag: 0;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: var(--dock-size, 52px);
  height: var(--dock-size, 52px);
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  /* Sin esto el <a> toma el azul de enlace del navegador y lo hereda la etiqueta. */
  color: var(--text);
  /* La magnificación es puro transform: no reflow, va a 60 fps. */
  transform: scale(calc(1 + var(--mag) * .55)) translateY(calc(var(--mag) * -8px));
  transform-origin: bottom center;
  transition: transform .16s var(--ease);
  touch-action: none;
}
.dock.no-magnify .dock__item { transform: none; }
.dock__item .favicon {
  width: 100%;
  height: 100%;
  border-radius: 24%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.dock__item--add .dock__plus {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  border-radius: 24%;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
}
.dock__item--add:hover .dock__plus { color: var(--text); border-color: var(--text-faint); }

.dock__sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 5px;
  background: var(--glass-edge-soft);
}

/* etiqueta flotante, como el Dock de macOS */
.dock__tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) scale(calc(1 / (1 + var(--mag) * .55)));
  transform-origin: bottom center;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s var(--ease);
}
.dock__item:hover .dock__tip { opacity: 1; }
.dock.is-dragging .dock__tip { opacity: 0 !important; }

.dock__item.is-dragging {
  z-index: 5;
  transition: none;
  opacity: .9;
}
.dock__item.is-pulled { opacity: .45; filter: grayscale(1); }
.dock__item.is-removing { transform: scale(.2) translateY(-40px); opacity: 0; transition: all .18s var(--ease); }
.dock__item.just-added { animation: dock-in .4s var(--ease); }
@keyframes dock-in {
  0% { transform: scale(.3) translateY(30px); opacity: 0; }
  60% { transform: scale(1.15) translateY(-4px); opacity: 1; }
  100% { transform: none; }
}

/* el dashboard deja hueco para el dock */
html.has-dock .app { padding-bottom: 120px; }
/* el modo minimalista es zen: fuera el dock */
html.is-minimal .dock { display: none; }
html.is-minimal.has-dock .app { padding-bottom: 40px; }

@media (max-width: 700px) {
  .dock__glass { padding: 6px 8px; border-radius: 18px; }
  .dock__item { width: 44px; height: 44px; }
  html.has-dock .app { padding-bottom: 104px; }
}

/* ============================= menú contextual ============================= */

.ctxmenu {
  position: fixed;
  z-index: 1500;
  min-width: 210px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(var(--panel-blur)) saturate(190%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(190%);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
  animation: pop .12s var(--ease);
}
.ctxmenu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 450;
  text-align: left;
  color: var(--panel-text);
}
.ctxmenu__item .icon { color: var(--panel-text-faint); }
.ctxmenu__item:hover .icon { color: var(--accent); }
.ctxmenu__item:hover { background: rgba(var(--accent-rgb), .16); }
.ctxmenu__item.is-danger { color: var(--danger); }
.ctxmenu__item.is-danger:hover { background: rgba(214, 69, 91, .14); }
.ctxmenu__sep { height: 1px; margin: 5px 8px; background: var(--glass-edge-soft); }

.minidialog {
  width: min(420px, 100%);
  max-height: 84vh;
  overflow: auto;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(var(--panel-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
  animation: pop .16s var(--ease);
}
.minidialog h3 { font-size: 15px; margin-bottom: 14px; }

/* ---------------- zonas de destino al arrastrar entre dock y pantalla ---------------- */

.dock__glass.is-drop-target {
  border-color: rgba(var(--accent-rgb), .75);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 0 0 3px rgba(var(--accent-rgb), .3),
    0 10px 40px rgba(0, 0, 0, .32);
  transform: translateY(-3px);
}
.dock__glass { transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease); }
.widget.is-over-zone { opacity: .55; transform: scale(.72); }
.grid.is-drop-target {
  outline: 2px dashed rgba(var(--accent-rgb), .45);
  outline-offset: 10px;
  border-radius: var(--radius-lg);
}

/* ============================ galería de widgets ============================ */

.overlay--sheet { align-items: flex-end; justify-content: center; padding: 0; }

.gal {
  width: min(760px, 100%);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  padding: 10px 22px 26px;
  border-radius: 30px 30px 0 0;
  border: 1px solid var(--panel-border);
  border-bottom: 0;
  background: var(--panel-bg);
  backdrop-filter: blur(var(--panel-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
  transform: translateY(101%);
  transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.gal.is-open { transform: none; }
/* Al arrastrar, la lámina se aparta y deja ver el escritorio entero. */
.gal.is-open.is-retracted {
  transform: translateY(calc(100% - 58px));
  opacity: .8;
}

.gal__grip {
  flex: none;
  width: 38px; height: 5px;
  border-radius: 3px;
  background: var(--text-faint);
  opacity: .4;
  margin: 0 auto 10px;
}
.gal__head { flex: none; display: flex; align-items: center; justify-content: space-between; }
.gal__head h2 { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.gal__hint { flex: none; font-size: 12.5px; margin: 2px 0 14px; }

.gal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  /* Igual que en el panel: el único que cede altura y se desplaza es la rejilla. */
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px;
}

.gal__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 10px 12px;
  border: 1px solid var(--glass-edge-soft);
  border-radius: 20px;
  background: rgba(var(--glass-tint), calc(var(--glass-alpha) * .5));
  cursor: grab;
  text-align: center;
  touch-action: none;
  transition: transform .16s var(--ease), border-color .16s var(--ease), background .16s var(--ease);
}
.gal__item:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb), .5); }
.gal__item:active { cursor: grabbing; }
.gal__item.is-source { opacity: .3; }

/* La vista previa respeta la proporción real del widget en la rejilla. */
.gal__preview {
  width: 100%;
  aspect-ratio: calc(var(--pv-cols, 4) / var(--pv-rows, 2));
  max-height: 74px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--glass-edge-soft);
  background: rgba(var(--glass-tint), calc(var(--glass-alpha) * .7));
  box-shadow: inset 0 1px 0 var(--glass-edge);
  color: var(--text-muted);
}
.gal__name { font-size: 13px; font-weight: 550; letter-spacing: -.008em; }
.gal__desc { font-size: 11px; line-height: 1.3; }

.gal__ghost {
  position: fixed;
  top: 0; left: 0;
  z-index: 1400;
  pointer-events: none;
  opacity: .92;
  box-shadow: var(--shadow-lg);
  transition: box-shadow .16s var(--ease);
}
.gal__ghost.is-ready { border-color: rgba(var(--accent-rgb), .8); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .3), var(--shadow-lg); }

/* ================================ tareas ================================ */

.tasks { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.tasks__form {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 9px;
  border-radius: 11px;
  background: rgba(var(--glass-tint), calc(var(--glass-alpha) * .55));
  border: 1px solid var(--glass-edge-soft);
}
.tasks__plus { color: var(--text-faint); display: flex; }
.tasks__input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 13.5px; color: var(--text); }
.tasks__input::placeholder { color: var(--text-faint); }
.tasks__list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow: auto; }
.tasks__item {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 4px;
  border-radius: 9px;
}
.tasks__item:hover { background: var(--surface-hover); }
.tasks__check {
  width: 17px; height: 17px; flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--text-faint);
  background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--accent-contrast);
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.tasks__check.is-done { background: var(--accent); border-color: var(--accent); }
.tasks__text { flex: 1; min-width: 0; font-size: 13.5px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tasks__item.is-done .tasks__text { text-decoration: line-through; color: var(--text-faint); }
.tasks__remove { opacity: 0; width: 22px; height: 22px; }
.tasks__item:hover .tasks__remove { opacity: 1; }
.tasks__empty { padding: 14px 4px; font-size: 13px; }
.tasks__foot { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; min-height: 18px; }
.tasks__clear { border: 0; background: transparent; color: var(--accent); font-size: 11.5px; cursor: pointer; padding: 0; }

/* ============================== calendario ============================== */

.cal { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.cal__head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal__title {
  flex: 1;
  border: 0; background: transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 590; letter-spacing: -.01em;
  color: var(--text);
  text-transform: capitalize;
  padding: 3px 6px; border-radius: 8px;
}
.cal__title:hover { background: var(--surface-hover); }
.cal__grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  align-content: start;
}
.cal__dow {
  font-size: 10px; font-weight: 600;
  color: var(--text-faint);
  text-align: center;
  padding-bottom: 3px;
}
.cal__cell {
  display: grid; place-items: center;
  aspect-ratio: 1;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  border-radius: 50%;
  color: var(--text-muted);
}
.cal__cell.is-today {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
.cal__cell.is-empty { visibility: hidden; }

/* ============================ reloj mundial ============================ */

.wclock { flex: 1; min-height: 0; overflow: auto; }
.wclock__list { display: flex; flex-direction: column; gap: 1px; }
.wclock__row {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 4px;
  border-radius: 9px;
}
.wclock__row:hover { background: var(--surface-hover); }
.wclock__dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--text-faint);
  opacity: .5;
}
.wclock__dot.is-day { background: var(--accent); opacity: 1; }
.wclock__where { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wclock__city { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wclock__off { font-size: 10.5px; }
.wclock__time {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.015em;
}
.wclock__remove { opacity: 0; width: 20px; height: 20px; }
.wclock__row:hover .wclock__remove { opacity: 1; }
.wclock__add {
  width: 100%; margin-top: 4px; padding: 5px;
  border: 1px dashed var(--glass-edge-soft); border-radius: 9px;
  background: transparent; color: var(--text-faint);
  font-size: 12px; cursor: pointer;
}
.wclock__add:hover { color: var(--text); border-color: var(--text-faint); }
.wclock__form { display: flex; flex-direction: column; gap: 7px; }

/* ============================== cuenta atrás ============================== */

.cdown { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.cdown__value {
  font-family: var(--font-display);
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 250;
  letter-spacing: -.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cdown__unit { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.cdown__title { font-size: 13.5px; font-weight: 550; margin-top: 8px; letter-spacing: -.008em; }
.cdown__date { font-size: 11.5px; }
.cdown.is-past .cdown__value { color: var(--text-faint); }
.cdown__form { display: flex; flex-direction: column; gap: 6px; width: 100%; }

/* ============================== calculadora ============================== */

.calc { flex: 1; display: flex; flex-direction: column; gap: 7px; min-height: 0; outline: none; }
.calc__display {
  text-align: right;
  padding: 4px 6px;
  min-height: 40px;
  display: flex; flex-direction: column; justify-content: center;
  border-radius: 10px;
  transition: background .2s var(--ease);
}
.calc__display.is-error { background: rgba(214, 69, 91, .18); }
.calc__expr {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calc__preview { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.calc__pad {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  min-height: 0;
}
.calc__key {
  border: 0;
  border-radius: 10px;
  background: rgba(var(--glass-tint), calc(var(--glass-alpha) * .55));
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .12s var(--ease), transform .08s var(--ease);
}
.calc__key:hover { background: rgba(var(--glass-tint), calc(var(--glass-alpha) * .9)); }
.calc__key:active { transform: scale(.94); }
.calc__key--op { color: var(--accent); font-weight: 600; }
.calc__key--clear { color: var(--danger); }

/* ================================ hábitos ================================ */

.habits { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 4px; }
.habits__head, .habits__row {
  display: grid;
  grid-template-columns: 1fr repeat(7, 18px) 22px;
  align-items: center;
  gap: 4px;
}
.habits__dow { font-size: 9.5px; font-weight: 600; color: var(--text-faint); text-align: center; }
.habits__dow.is-today { color: var(--accent); }
.habits__list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.habits__row { padding: 3px 0; border-radius: 8px; position: relative; }
.habits__row:hover { background: var(--surface-hover); }
.habits__name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habits__dot {
  width: 16px; height: 16px;
  justify-self: center;
  border-radius: 50%;
  border: 1.5px solid var(--glass-edge-soft);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background .14s var(--ease), transform .1s var(--ease);
}
.habits__dot:hover:not(:disabled) { border-color: var(--text-faint); }
.habits__dot.is-done { background: var(--accent); border-color: var(--accent); }
.habits__dot.is-today { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .25); }
.habits__dot:disabled { opacity: .3; cursor: default; }
.habits__dot:active:not(:disabled) { transform: scale(.85); }
.habits__streak {
  font-size: 11px; font-weight: 600;
  color: var(--text-faint);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.habits__streak.is-active { color: var(--accent); }
.habits__remove { position: absolute; right: -2px; opacity: 0; width: 20px; height: 20px; }
.habits__row:hover .habits__remove { opacity: 1; }
.habits__form {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  border-radius: 10px;
  border: 1px solid var(--glass-edge-soft);
  background: rgba(var(--glass-tint), calc(var(--glass-alpha) * .5));
}
.habits__plus { color: var(--text-faint); display: flex; }
.habits__input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 12.5px; color: var(--text); }
.habits__input::placeholder { color: var(--text-faint); }
