/* ============================================================
   Capa de escritorio. Se carga DESPUÉS de app.css y sólo añade;
   por debajo de 1024 px casi todo aquí está inerte, así que el
   móvil sigue exactamente igual que antes.
   ============================================================ */

/* ── Piezas nuevas que existen en ambos anchos ───────────── */
.shell { display: block; }
.sidebar { display: none; }
.desk-only { display: none !important; }
.lbl-desk { display: none; }

kbd {
  font: inherit; font-size: 11px; font-weight: 700; line-height: 1;
  background: var(--bg3); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 5px; color: var(--text2);
  display: inline-block; min-width: 18px; text-align: center;
}

/* Panel de ayuda de atajos */
.kbdhelp-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: fadein .15s ease;
}
.kbdhelp {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px; width: min(720px, 100%); max-height: 82vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.kbdhelp-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.kbdhelp-head b { font-size: 16px; }
.kbdhelp-cols { display: grid; grid-template-columns: 1fr; gap: 4px 28px; }
.kbdhelp-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; padding: 3px 0; color: var(--text2); }
.kbdhelp-keys { flex: 0 0 84px; display: flex; gap: 3px; }

/* Placeholder del panel de detalle */
.detail-empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 44px 22px; text-align: center; color: var(--text3); font-size: 13.5px;
}
.detail-empty .big { font-size: 34px; margin-bottom: 8px; }

/* Densidad compacta de la lista de notas */
.cards.compact { gap: 6px; }
.cards.compact .card { padding: 8px 10px; gap: 10px; border-radius: 10px; }
.cards.compact .card .thumb,
.cards.compact .card .noimg { width: 54px; height: 54px; border-radius: 8px; font-size: 18px; }
.cards.compact .card .title { -webkit-line-clamp: 2; font-size: 13.5px; margin-bottom: 3px; }
.cards.compact .card .meta { font-size: 11px; gap: 5px; }
.cards.compact .card .check { top: 6px; right: 6px; width: 20px; height: 20px; }

/* Nota que se está leyendo en el panel */
.card.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }

/* ── Selección diaria ────────────────────────────────────── */
.sel-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.sel-cat { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sel-cat-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 2px 2px 0;
}
.sel-cat-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.sel-cat-head b { font-size: 14px; }
.sel-n {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--text3);
  background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}
.sel-thin {
  font-size: 13px; color: var(--text3); padding: 14px;
  border: 1px dashed var(--line); border-radius: var(--radius);
}
.sel-why {
  font-size: 12px; color: var(--text3); line-height: 1.35;
  margin-bottom: 6px; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sel-score {
  font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 6px;
  flex: 0 0 auto; letter-spacing: .01em;
}
.sel-score.alto  { background: color-mix(in srgb, var(--green) 20%, var(--card)); color: var(--green); }
.sel-score.medio { background: color-mix(in srgb, var(--amber) 20%, var(--card)); color: var(--amber); }
.sel-score.bajo  { background: var(--bg3); color: var(--text3); }
.badge.fuerte {
  background: color-mix(in srgb, var(--red) 16%, var(--card));
  color: var(--red);
}
.sel-card .title { -webkit-line-clamp: 3; }

/* Variante informativa del banner: el rojo de .banner-down se lee como error. */
.banner-info {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--text2); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 12px; font-size: 13px;
}
.banner-info svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; color: var(--text3); }

.quota-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
@media (min-width: 1024px) { .quota-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── De 1024 px para arriba: escritorio ──────────────────── */
@media (min-width: 1024px) {
  :root { --nav-h: 22px; --side-w: 228px; }

  .nav { display: none; }
  .mob-only { display: none !important; }
  .desk-only { display: flex !important; }
  .btn.desk-only { display: inline-flex !important; }

  body { font-size: 15px; }
  .card:active { transform: none; }         /* el "pulso" táctil sobra con mouse */

  /* Cascarón: barra lateral fija + área de trabajo */
  .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
  #viewport { min-width: 0; }

  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--bg2); border-right: 1px solid var(--line);
    padding: 16px 12px 12px;
  }
  .sb-brand {
    display: flex; align-items: center; gap: 9px;
    font-weight: 800; font-size: 15.5px; letter-spacing: -.01em;
    padding: 4px 8px 14px;
  }
  .sb-brand .sb-logo { font-size: 19px; }
  .sb-nav { display: flex; flex-direction: column; gap: 2px; }
  .sb-sep {
    font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    color: var(--text3); padding: 16px 10px 6px;
  }
  .sb-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border-radius: 10px; text-align: left;
    font-size: 14px; font-weight: 600; color: var(--text2);
  }
  .sb-item svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: 0 0 auto; }
  .sb-item:hover { background: var(--bg3); color: var(--text); }
  .sb-item.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

  .sb-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
  .sb-mini {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 7px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text3);
  }
  .sb-mini svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
  .sb-mini kbd { margin-left: auto; }
  .sb-mini:hover { background: var(--bg3); color: var(--text); }
  .sb-user {
    font-size: 11.5px; color: var(--text3); padding: 8px 10px 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  /* Vistas: ya no viven en una columna de 760 px */
  .view { max-width: 1120px; padding: 0 26px 40px; }
  .view-tablero { max-width: none; }
  .topbar { padding-top: 18px; background: linear-gradient(var(--bg) 82%, transparent); }
  .topbar h1 { font-size: 23px; }

  /* Tablero: de 1024 a 1359 sólo caben dos paneles (filtros + lista);
     el detalle sigue siendo modal. El tercer panel entra en 1360. */
  .tb-layout {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    gap: 20px; align-items: start;
  }
  .tb-detail { display: none; }
  .tb-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 4px; }
  .tb-side .chips {
    flex-direction: column; align-items: stretch; gap: 4px;
    overflow: visible; padding: 0 0 12px;
  }
  .tb-side .chip { justify-content: flex-start; min-height: 34px; padding: 7px 12px; border-radius: 9px; }
  .tb-side .chip .n { margin-left: auto; }
  .tb-side .subfilters { flex-direction: column; align-items: stretch; gap: 8px; }
  .tb-side .seg { width: 100%; }
  .tb-side .seg button { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; white-space: nowrap; }
  .tb-side .grp-toggle {
    margin-left: 0; width: 100%; height: 36px; border-radius: 10px;
    justify-content: flex-start; gap: 9px; padding: 0 12px;
    font-size: 13px; font-weight: 600; color: var(--text2);
  }
  .tb-side .grp-toggle svg { width: 17px; height: 17px; }
  .tb-side .grp-toggle.on { color: #fff; }
  .tb-main { min-width: 0; }
  .lbl-desk { display: inline; }

  /* El sheet acoplado: ya no es un modal, es una columna más */
  .sheet-panel {
    position: static; margin: 0; width: 100%; max-width: none;
    max-height: calc(100vh - 104px);
    border: 1px solid var(--line); border-radius: var(--radius);
    animation: panelin .16s ease;
  }
  @keyframes panelin { from { opacity: 0; transform: translateY(6px); } }
  .sheet-panel .sheet-head { padding-top: 14px; }
  .sheet-panel .hero { max-height: 170px; }

  /* El resto de sheets pasan a ser modales centrados */
  .sheet:not(.sheet-panel) {
    left: 50%; right: auto; top: 50%; bottom: auto; margin: 0;
    transform: translate(-50%, -50%);
    width: min(720px, 92vw); max-width: none; max-height: 86vh;
    border-radius: 18px; border: 1px solid var(--line);
    box-shadow: 0 24px 70px rgba(0,0,0,.5);
    animation: modalin .18s cubic-bezier(.2,.9,.3,1);
  }
  @keyframes modalin { from { opacity: 0; transform: translate(-50%, -46%); } }
  .sheet:not(.sheet-panel) .grab { display: none; }
  .sheet:not(.sheet-panel) .sheet-head { padding-top: 16px; }

  /* Selección: las secciones en columnas para verlas todas de un vistazo */
  .view-seleccion { max-width: 1500px; }
  .sel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 24px; align-items: start; }

  /* Barras flotantes: fuera de la sidebar */
  .selbar { left: calc(var(--side-w) + 26px); right: 26px; max-width: 620px; bottom: 22px; }
  .jobdock { left: auto; right: 22px; bottom: 22px; width: 360px; }
  .toast { bottom: 24px; }

  /* Formularios: en pantalla ancha las etiquetas no necesitan 100% */
  .login-card { max-width: 380px; }
  .kbdhelp-cols { grid-template-columns: 1fr 1fr; }
}

/* ── 1360 px: entra el tercer panel (detalle acoplado) ───── */
@media (min-width: 1360px) {
  .tb-layout { grid-template-columns: 208px minmax(340px, 1fr) minmax(360px, 440px); }
  .tb-detail { display: block; position: sticky; top: 84px; max-height: calc(100vh - 104px); }
}

/* ── Monitores grandes: más aire y una lista más ancha ───── */
@media (min-width: 1600px) {
  .tb-layout { grid-template-columns: 228px minmax(400px, 1fr) minmax(420px, 520px); gap: 24px; }
  .view { max-width: 1320px; }
  .view-tablero { max-width: none; }   /* el tablero siempre usa todo el ancho */
  .view-seleccion { max-width: none; }
  .sel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
