/* views.css — Estilos por vista: formulario de proyecto, tarjetas de documentos/notas, editor, API keys, panel info. */

  /* ─── Full-screen project form ─── */
  .form-view {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 20px 40px;
  }
  .form-view-head {
    margin-bottom: 32px;
  }
  .form-view h2 {
    font-family: 'Instrument Serif', serif;
    font-weight: 400; font-size: 34px;
    letter-spacing: -0.015em;
    margin: 0 0 6px;
    text-wrap: balance;
  }
  .form-view .form-sub {
    color: var(--fg-muted); font-size: 14px; line-height: 1.5;
    margin: 0;
  }
  .form-section {
    margin-bottom: 28px;
  }
  .form-section-label {
    display: block;
    font-size: 13px; font-weight: 600;
    color: var(--fg); margin-bottom: 10px;
    letter-spacing: -0.005em;
  }
  .form-section-hint {
    display: block;
    font-size: 12.5px; color: var(--fg-muted);
    margin: -6px 0 10px; line-height: 1.5;
  }
  .form-title-input {
    width: 100%;
    padding: 10px 0;
    font-family: 'Instrument Serif', serif;
    font-size: 28px; letter-spacing: -0.01em;
    font-weight: 400;
    color: var(--fg);
    background: transparent;
    border: 0; border-bottom: 1.5px solid var(--border);
    outline: none;
    transition: border-color .15s;
  }
  .form-title-input::placeholder { color: var(--fg-faint); font-style: italic; }
  .form-title-input:focus { border-color: var(--fg); }

  /* ─── Icono y color del proyecto ───
     Una tarjeta: arriba la vista previa (el cuadrado tal como saldrá en el
     encabezado y en las tarjetas), debajo los iconos y los colores. El color se
     ve en un solo sitio, la vista previa; el icono elegido solo lleva un aro. */
  .pf-ident {
    border: 1px solid var(--border); border-radius: 14px;
    background: var(--surface-2); padding: 14px;
  }
  .pf-prev { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
  /* Dentro va la MISMA miniatura de la tarjeta (projectThumb), así la previa no
     puede prometer algo distinto de lo que se verá después. */
  .pf-prev-tile {
    width: 56px; height: 56px; flex: 0 0 auto; display: grid; place-items: center;
    border-radius: 14px; box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .45);
  }
  .pf-prev-tile .pc-thumb { width: 56px; height: 56px; border-radius: 14px; transition: background .2s ease; }
  .pf-prev-tile .pc-thumb-ico svg { width: 26px; height: 26px; }
  .pf-prev-txt { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
  .pf-prev-name {
    font-family: 'Instrument Serif', serif; font-weight: 400; font-size: 22px; line-height: 1.15;
    color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .pf-prev-cap { font-size: 12.5px; color: var(--fg-muted); }
  .pf-icons { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
  @media (max-width: 560px) { .pf-icons { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
  .pf-icon {
    aspect-ratio: 1; min-height: 40px; border-radius: 11px; cursor: pointer;
    display: grid; place-items: center;
    background: var(--surface); color: var(--fg-muted);
    border: 1px solid var(--border);
    transition: color .15s, border-color .15s, box-shadow .15s, transform .1s;
  }
  .pf-icon svg { width: 19px; height: 19px; }
  .pf-icon:hover { color: var(--fg); border-color: var(--border-strong); }
  .pf-icon:active { transform: scale(.95); }
  /* Un solo filo: el borde. Con el aro de 1px encima parecía doble línea. */
  .pf-icon[aria-pressed="true"] { color: var(--fg); border-color: var(--fg); background: var(--surface-sunken); }
  /* «Auto» lleva texto y ocupa dos celdas: así se entiende sin pasar el ratón y
     la cuadrícula cierra en 2×10 (escritorio) y 4×5 (teléfono), sin huecos. */
  .pf-icon.is-auto {
    grid-column: span 2; aspect-ratio: auto;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-size: 12.5px; font-weight: 600;
  }
  .pf-icon.is-auto svg { width: 16px; height: 16px; flex: none; }
  .pf-colors { margin-top: 14px; }
  /* La regla global :focus-visible cuadra el recuadro; aquí se respeta la forma. */
  .pf-colors .color-swatch:focus-visible { border-radius: 50%; }
  .pf-icon:focus-visible { border-radius: 11px; }
  /* Aro del color elegido: separado del relleno, sin agrandarlo (a 1.1× parecía
     un segundo círculo pegado al borde). */
  .pf-colors .color-swatch[aria-pressed="true"] {
    border-color: transparent; transform: none;
    box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--fg);
  }
  @media (prefers-reduced-motion: reduce) { .pf-prev-tile .pc-thumb, .pf-icon { transition: none; } }
  /* En el teléfono el círculo de 28px se queda corto para el dedo: se reparte en
     8 columnas y cada uno gana 8px de zona sensible alrededor, sin cambiar nada
     de lo que se ve. */
  @media (max-width: 560px) {
    /* Con .color-picker a secas no bastaba: overlays.css va después y su
       display:flex ganaba por orden de archivo. */
    .color-picker.pf-colors { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0; }
    .pf-colors .color-swatch { justify-self: center; position: relative; }
    .pf-colors .color-swatch::after { content: ''; position: absolute; inset: -9px -8px; }
  }
  .form-area {
    width: 100%; min-height: 120px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--fg); font: inherit; font-size: 14.5px;
    line-height: 1.6;
    resize: vertical;
  }
  .form-area:focus {
    outline: none; border-color: var(--fg); background: var(--surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 14%, transparent);
  }
  .vis-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  @media (max-width: 480px) { .vis-choice { grid-template-columns: 1fr; } }
  .vis-opt {
    display: flex; flex-direction: column; gap: 6px;
    padding: 16px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: left;
    font: inherit;
  }
  .vis-opt:hover { border-color: var(--border-strong); }
  .vis-opt[aria-checked="true"] {
    border-color: var(--fg);
    background: var(--surface);
  }
  .vis-opt .vo-head {
    display: flex; align-items: center; gap: 8px;
    font-weight: 600; font-size: 14px; color: var(--fg);
  }
  .vis-opt .vo-head svg { width: 15px; height: 15px; }
  .vis-opt .vo-desc { color: var(--fg-muted); font-size: 12.5px; line-height: 1.45; margin: 0; }
  .vis-opt .vo-radio {
    width: 16px; height: 16px; border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    display: grid; place-items: center;
    margin-left: auto;
    transition: border-color .15s;
    flex-shrink: 0;
  }
  .vis-opt[aria-checked="true"] .vo-radio { border-color: var(--fg); }
  .vis-opt[aria-checked="true"] .vo-radio::after {
    content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--fg);
  }
  .form-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
  }
  @media (max-width: 480px) {
    .form-foot { flex-direction: column-reverse; }
    .form-foot .btn { width: 100%; }
  }

  /* Visibility badge */
  .vis-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 500;
    background: var(--surface-sunken); color: var(--fg-muted);
  }
  .vis-badge svg { width: 11px; height: 11px; }

  /* ─── Document / file / note cards ─── */
  .doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
  .doc-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s;
    position: relative;
  }
  .doc-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 8px 20px -8px rgba(0,0,0,.08);
  }
  .doc-icon {
    width: 36px; height: 36px; border-radius: 9px;
    display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent-ink);
    margin-bottom: 10px;
  }
  .doc-icon svg { width: 18px; height: 18px; }
  .doc-icon.file { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
  .doc-icon.note { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
  .doc-icon.file-img { padding: 0; overflow: hidden; background: var(--surface-sunken); }
  .doc-icon.file-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .files-meta { font-size: 12.5px; color: var(--fg-muted); margin: 0 0 14px; font-weight: 500;
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
  /* «Borrar todo» (borra todos los archivos, con confirmación) */
  .files-clear { gap: 6px; flex-shrink: 0; }
  .files-clear svg { width: 14px; height: 14px; }
  .doc-title {
    font-weight: 600; font-size: 13.5px; margin: 0 0 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .doc-meta { font-size: 11.5px; color: var(--fg-muted); }
  .doc-preview {
    font-size: 12.5px; color: var(--fg-muted);
    margin: 6px 0 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
  }

  /* ─── Note editor ─── */
  .editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 16px;
    min-height: 500px;
  }
  @media (max-width: 820px) { .editor { grid-template-columns: 1fr; } .analyze-pane { order: -1; } }
  .editor-main {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    display: flex; flex-direction: column; gap: 10px;
  }
  .editor-title {
    width: 100%; border: 0; background: transparent;
    font: inherit; font-family: 'Instrument Serif', serif;
    font-size: 28px; color: var(--fg);
    letter-spacing: -0.01em; padding: 4px 0;
  }
  .editor-title:focus { outline: none; }
  .editor-body {
    width: 100%; flex: 1; min-height: 360px;
    border: 0; background: transparent;
    font: inherit; font-size: 14.5px; line-height: 1.6;
    color: var(--fg); resize: none;
  }
  .editor-body:focus { outline: none; }
  .editor-tags {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    padding-top: 10px; border-top: 1px solid var(--border);
  }
  .editor-tags input {
    border: 0; background: transparent; font: inherit; font-size: 12.5px;
    color: var(--fg); padding: 4px 6px; min-width: 100px; flex: 1;
  }
  .editor-tags input:focus { outline: none; }
  .chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 999px;
    background: var(--surface-sunken); color: var(--fg-muted);
    font-size: 11.5px; font-weight: 500;
  }
  .chip button {
    background: transparent; border: 0; cursor: pointer;
    color: var(--fg-faint); padding: 0; line-height: 1;
    font-size: 13px;
  }
  .chip button:hover { color: var(--danger); }

  .analyze-pane {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    align-self: start;
    position: sticky; top: 0;
  }
  .analyze-pane h4 {
    margin: 0 0 12px; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--fg-muted); font-weight: 600;
  }
  .analyze-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 7px 0; border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  .analyze-row:last-of-type { border-bottom: 0; }
  .analyze-row dt { color: var(--fg-muted); }
  .analyze-row dd {
    margin: 0; font-weight: 600; font-variant-numeric: tabular-nums;
  }
  .top-words {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .top-words h5 {
    margin: 0 0 8px; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--fg-muted); font-weight: 600;
  }
  .word-bar {
    display: grid; grid-template-columns: 1fr auto; gap: 8px;
    align-items: center; font-size: 12.5px;
    padding: 3px 0;
  }
  .word-bar .wname {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .word-bar .wval {
    color: var(--fg-muted); font-variant-numeric: tabular-nums;
    font-size: 11.5px;
  }

  /* ─── API keys ─── */
  .key-list { display: flex; flex-direction: column; gap: 10px; }
  .key-row {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex; flex-direction: column; gap: 14px;
  }
  .key-head {
    display: grid; grid-template-columns: 1fr auto; gap: 12px;
    align-items: start;
  }
  .key-main { min-width: 0; }
  .key-name {
    font-weight: 600; font-size: 14.5px; margin: 0 0 6px;
    display: flex; align-items: center; gap: 8px;
  }
  .key-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 7px; border-radius: 999px;
    font-size: 10.5px; font-weight: 600;
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
    text-transform: uppercase; letter-spacing: 0.04em;
  }
  .key-badge.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
  .key-badge.danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
  .key-value {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px; color: var(--fg-muted);
    display: flex; align-items: center; gap: 8px;
    overflow: hidden;
  }
  .key-value code {
    background: var(--surface-sunken);
    padding: 3px 8px; border-radius: 6px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0;
  }
  .key-meta { font-size: 11.5px; color: var(--fg-faint); margin-top: 6px; }
  .key-actions { display: flex; gap: 4px; flex-shrink: 0; }
  /* El botón de menú "⋮" solo se usa en móvil; en escritorio van los iconos */
  .key-more { display: none; }
  @media (max-width: 640px) {
    .key-actions > .icon-btn:not(.key-more) { display: none; }
    .key-more { display: grid; }
  }

  /* Usage card inside key row */
  .usage {
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }
  .usage-main { min-width: 0; }
  .usage-progress-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 6px;
  }
  .usage-progress-label {
    font-size: 11.5px; color: var(--fg-muted);
    text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  }
  .usage-progress-value {
    font-size: 13px; font-variant-numeric: tabular-nums;
    color: var(--fg); font-weight: 500;
  }
  .usage-progress-value .pct { color: var(--fg-muted); margin-left: 6px; font-size: 12px; }
  .progress {
    height: 8px; width: 100%;
    background: var(--surface-sunken);
    border-radius: 999px; overflow: hidden;
  }
  .progress > span {
    display: block; height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width .35s ease;
  }
  .progress.warn > span { background: var(--warn); }
  .progress.danger > span { background: var(--danger); }
  /* Colores de segmento por tipo */
  .progress > span.ok { background: var(--success); }
  .progress > span.err { background: var(--danger); }

  /* ─── Éxitos / Fallas (dos filas con su barra) ─── */
  .success-fail {
    display: grid; grid-template-columns: 1fr 1fr; gap: 22px;
    margin-top: 16px;
  }
  .success-fail .sf-item:first-child {
    border-right: 1px solid var(--border); padding-right: 22px;
  }
  .sf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
  .sf-icon {
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; flex-shrink: 0;
  }
  .sf-icon svg { width: 14px; height: 14px; }
  .sf-icon.ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
  .sf-icon.err { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
  .sf-label { font-size: 14px; font-weight: 500; color: var(--fg); }
  .sf-val { margin-left: auto; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .sf-pct { font-size: 12.5px; color: var(--fg-muted); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
  @media (max-width: 640px) {
    .success-fail { grid-template-columns: 1fr; gap: 14px; }
    .success-fail .sf-item:first-child {
      border-right: 0; padding-right: 0;
      border-bottom: 1px solid var(--border); padding-bottom: 14px;
    }
  }

  /* ─── Gráfica de solicitudes (barras apiladas + tooltip) ─── */
  .chart {
    margin-top: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px 10px;
  }
  .chart-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    margin-bottom: 18px;
  }
  .chart-sub { font-size: 12px; color: var(--fg-muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
  .chart-title {
    font-size: 11px; color: var(--fg-muted);
    text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  }
  .chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--fg-muted); }
  .chart-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
  .chart-legend .lg::before { content: ''; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
  .chart-legend .lg.ok::before { background: var(--success); }
  .chart-legend .lg.err::before { background: var(--danger); }

  /* margin-top deja aire para la etiqueta superior del eje y los valores de las barras */
  .chart-plot { position: relative; height: 170px; margin-left: 36px; margin-top: 14px; }
  .cgrid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
  .cgrid.base { border-top-style: solid; border-top-color: var(--border-strong); }
  .cgrid-lbl {
    position: absolute; left: -36px; top: -7px; width: 31px; text-align: right;
    font-size: 9.5px; color: var(--fg-faint); font-variant-numeric: tabular-nums;
  }
  .chart-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3%; }
  .cbar-col {
    flex: 1; height: 100%;
    display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
    gap: 4px; cursor: pointer; outline: none;
  }
  .cbar-val {
    font-size: 10.5px; color: var(--fg-muted); font-weight: 600;
    font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1;
  }
  .cbar {
    width: 64%; max-width: 44px;
    border-radius: 5px 5px 0 0; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end;
    transition: filter .12s;
  }
  .cbar-col:hover .cbar, .cbar-col:focus .cbar { filter: brightness(1.06); }
  .cseg { width: 100%; }
  .cseg.ok { background: var(--success); }
  .cseg.err { background: var(--danger); }
  .cbar.is-zero { height: 2px; background: var(--border-strong); border-radius: 2px; }
  .chart-empty {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    max-width: 92%; padding: 4px 12px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    text-align: center; font-size: 12.5px; color: var(--fg-muted); pointer-events: none;
  }
  .chart-xlabels { display: flex; gap: 3%; margin-left: 36px; margin-top: 8px; }
  .chart-xlabels span {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px;
    font-size: 11px; color: var(--fg-muted); line-height: 1.2;
  }
  .chart-xlabels span b { font-weight: 600; }
  .chart-xlabels span small { font-size: 10px; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
  .chart-xlabels span.today b { color: var(--fg); }

  /* Tooltip de la gráfica */
  .chart-tip {
    position: absolute; z-index: 5; width: 168px;
    background: #15181f; color: #e7eaf0;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px; padding: 9px 11px;
    box-shadow: 0 12px 30px -8px rgba(0,0,0,.5);
    pointer-events: none; font-variant-numeric: tabular-nums;
  }
  .chart-tip .ct-title { font-size: 11.5px; font-weight: 600; margin-bottom: 6px; color: #fff; text-transform: capitalize; }
  .chart-tip .ct-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin: 3px 0; font-size: 11.5px; }
  .chart-tip .ct-k { display: inline-flex; align-items: center; gap: 6px; color: #c7ccd6; }
  .chart-tip .ct-k::before { content: ''; width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
  .chart-tip .ct-k.ok::before { background: var(--success); }
  .chart-tip .ct-k.err::before { background: var(--danger); }
  .chart-tip .ct-v { font-weight: 700; color: #fff; }
  .chart-tip .ct-p { color: #9aa2b1; font-size: 10.5px; min-width: 38px; text-align: right; }
  .chart-tip .ct-total {
    display: flex; justify-content: space-between; margin-top: 7px; padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,.12); font-size: 11.5px; font-weight: 600; color: #fff;
  }

  .usage-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; margin-top: 2px;
  }
  .usage-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    min-width: 0;
  }
  .usage-stat .lbl {
    font-size: 10.5px; color: var(--fg-faint);
    text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
    margin-bottom: 4px;
  }
  .usage-stat .val {
    font-size: 15px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .usage-stat .val .unit { font-size: 11px; color: var(--fg-muted); font-weight: 500; margin-left: 2px; }
  .usage-stat .sub { font-size: 11.5px; color: var(--fg-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Indicador de datos en tiempo real */
  .live-badge {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 11.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums;
  }
  .live-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--success);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent);
    animation: live-pulse 2s infinite;
  }
  @keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
  }
  @media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

  .spark {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 3px;
    height: 56px;
    padding: 4px 0 0;
  }
  .spark-bar {
    flex: 1; min-width: 0;
    background: var(--surface-sunken);
    border-radius: 3px;
    overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end;
    min-height: 2px;
  }
  /* Segmentos apilados: error (arriba, rojo) + éxito (abajo, azul) */
  .spark-seg { width: 100%; }
  .spark-seg.ok { background: var(--accent); }
  .spark-seg.err { background: var(--danger); }
  .spark-bar.on { opacity: 0.9; }
  .spark-bar.today { opacity: 1; }

  /* Leyenda de la gráfica */
  .spark-legend {
    display: flex; gap: 14px; margin-top: 8px;
    font-size: 10.5px; color: var(--fg-muted);
  }
  .spark-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
  .spark-legend .lg::before {
    content: ''; width: 8px; height: 8px; border-radius: 2px; display: inline-block;
  }
  .spark-legend .lg.ok::before { background: var(--accent); }
  .spark-legend .lg.err::before { background: var(--danger); }
  .spark-labels {
    display: flex; justify-content: space-between;
    font-size: 10px; color: var(--fg-faint);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
  }
  .spark-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px 8px;
  }
  .spark-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 2px;
  }
  .spark-title {
    font-size: 10.5px; color: var(--fg-faint);
    text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  }
  .spark-total {
    font-size: 12px; font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  /* ─── Info panel ─── */
  .info { padding: 18px; overflow: auto; }
  .info-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
  }
  .info-head h3 { font-weight: 600; font-size: 14px; margin: 0; }
  .stat-mini {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  }
  .stat-mini-label {
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; color: var(--fg-muted); font-weight: 500;
    margin-bottom: 6px;
  }
  .stat-mini-label svg { width: 13px; height: 13px; }
  .stat-mini-value {
    font-size: 20px; font-weight: 600; letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
  }
  .stat-mini-value .unit { font-size: 11px; color: var(--fg-muted); font-weight: 500; margin-left: 3px; }

  .info-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
  .info-section h4 {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--fg-faint); margin: 0 0 10px; font-weight: 600;
  }
  .kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
  .kv dt { color: var(--fg-muted); }
  .kv dd { margin: 0; color: var(--fg); font-variant-numeric: tabular-nums; }
  .recent-list { display: flex; flex-direction: column; gap: 2px; }
  .recent-list a {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: 7px;
    color: var(--fg-muted); text-decoration: none;
    font-size: 12.5px; cursor: pointer;
  }
  .recent-list a:hover { background: var(--surface-sunken); color: var(--fg); }
  .recent-list svg { width: 13px; height: 13px; opacity: 0.75; flex-shrink: 0; }
  .recent-list .nm {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1;
  }
  .recent-list .ts { font-size: 11px; color: var(--fg-faint); flex-shrink: 0; }

/* ─── Clave API del proyecto (pestaña Ajustes) ─── */
.apikey-card {
  margin-top: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.apikey-head h4 {
  margin: 0 0 4px;
  font-size: 14px; font-weight: 600; color: var(--fg);
}
.apikey-head p {
  margin: 0 0 12px;
  font-size: 12.5px; color: var(--fg-muted); line-height: 1.45;
}
.apikey-row { display: flex; gap: 8px; align-items: center; }
.apikey-value {
  flex: 1; min-width: 0;
  padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px; color: var(--fg);
  letter-spacing: 0.02em;
}
.apikey-value:focus { outline: none; border-color: var(--fg); }
.apikey-row .icon-btn { flex-shrink: 0; }
.apikey-idrow {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.apikey-idlabel { font-size: 13px; color: var(--fg-muted); }
.apikey-id {
  flex: 1; min-width: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; color: var(--fg);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.apikey-actions { margin-top: 14px; }

/* Tarjetas resumen de API keys: 4 en fila si caben, si no 2×2 (nunca 3 + 1). */
.tiles-keys-wrap { container-type: inline-size; }
.tiles-keys-wrap .tiles-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 760px) {
  .tiles-keys-wrap .tiles-keys { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}


/* ─── Archivos con banner (portada, carátula, miniatura de video) ─── */
.file-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.doc-card.file-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.doc-card.file-card .card-actions { z-index: 3; }
.fc-body { padding: 10px 12px 12px; min-width: 0; }
.fc-body .doc-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-art {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  display: grid; place-items: center;
  background: var(--surface-sunken); color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}
.fb-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-art.fb-audio.has-img img { object-fit: cover; }
.fb-icon svg { width: 34px; height: 34px; }
.fb-art.fb-audio:not(.has-img) { background: linear-gradient(135deg, color-mix(in srgb, #8b5cf6 30%, var(--surface-sunken)), color-mix(in srgb, #ec4899 22%, var(--surface-sunken))); color: var(--fg); }
.fb-art.fb-video:not(.has-img) { background: linear-gradient(135deg, color-mix(in srgb, #0ea5e9 26%, var(--surface-sunken)), var(--surface-sunken)); color: var(--fg); }
.fb-art.fb-pdf:not(.has-img) { color: var(--danger); }
.fb-art.fb-image:not(.has-img) { color: var(--success); }
.fb-badge, .fb-dur {
  position: absolute; bottom: 8px; z-index: 1;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(10, 10, 11, .66); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.fb-badge { left: 8px; }
.fb-dur { right: 8px; font-variant-numeric: tabular-nums; }
.fb-play {
  position: absolute; z-index: 1; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); color: #111;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .5);
  transition: transform .15s;
}
.fb-play svg { width: 17px; height: 17px; margin-left: 2px; }
.file-card:hover .fb-play { transform: scale(1.08); }

/* ─── Panel de subida (muchos archivos) ─── */
.upanel {
  position: fixed; right: 16px; bottom: 16px; z-index: 1500;
  width: min(340px, calc(100vw - 32px));
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .35);
  padding: 14px;
}
.up-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.up-count { font-size: 12.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.up-sub { font-size: 12px; color: var(--fg-muted); margin-top: 8px; }
.up-errors { margin: 0; padding-left: 18px; font-size: 12px; color: var(--fg-muted); max-height: 160px; overflow: auto; }

.up-head .up-count { margin-left: auto; }
.up-open { padding: 2px 10px; }

/* ─── Página «Subir archivos» ───
   Ocupa todo el panel central (la sección de atrás se oculta mientras tanto);
   en teléfono, toda la pantalla. Barra fija arriba, zona para soltar/elegir
   y la lista de subidas a lo ancho. */
.board.is-uploading > .board-top, .board.is-uploading > #view { display: none; }
.upd {
  --upd-k: var(--fg-faint);
  flex: 1; display: flex; flex-direction: column; min-height: 100%;
  background: var(--surface); color: var(--fg);
  animation: upd-page-in .28s cubic-bezier(.22, 1, .36, 1);
}
.upd.is-standalone { position: fixed; inset: 0; z-index: 90; overflow: auto; }
@keyframes upd-page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.upd-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px 16px 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.upd-back svg { width: 18px; height: 18px; }
.upd-head-ico {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%; color: var(--fg);
}
.upd-head-ico svg { width: 22px; height: 22px; }
.upd-head-txt { flex: 1; min-width: 0; }
.upd-head-txt h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.upd-head-txt p { margin: 3px 0 0; font-size: 13.5px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upd-body { flex: 1; padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.upd-input { display: none; }
.upd-uploads { display: flex; flex-direction: column; gap: 12px; }
.upd-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.upd-list-head[hidden] { display: none; }
.upd-list-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.upd-sum { font-size: 12.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }

.upd-zone {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 44px 24px 36px;
  border: 1.5px dashed var(--border-strong); border-radius: 18px;
  background: var(--surface-2);
  cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.upd-zone:hover { border-color: var(--fg-faint); }
.upd-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.upd-zone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.upd-zone-ico { color: var(--fg-muted); margin-bottom: 4px; }
.upd-zone-ico svg { width: 30px; height: 30px; }
.upd-zone.is-over .upd-zone-ico { color: var(--accent); }
.upd-zone strong { font-size: 15.5px; font-weight: 600; }
.upd-zone-sub { font-size: 12.5px; color: var(--fg-faint); max-width: 320px; }
.upd-browse { margin-top: 10px; border: 1px solid var(--border-strong); background: var(--surface); }

.upd-list { display: flex; flex-direction: column; gap: 10px; }
.upd-list:empty { display: none; }
.upd-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 14px;
  padding: 14px 12px 14px 14px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  animation: upd-in .25s cubic-bezier(.22, 1, .36, 1);
}
@keyframes upd-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.upd-item.has-bar { row-gap: 12px; }
.upd-bar { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--surface-sunken); overflow: hidden; display: none; }
.upd-item.has-bar .upd-bar { display: block; }
.upd-fill { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--accent); transition: width .25s ease; }

/* Icono de hoja con la extensión, coloreada por tipo de archivo. */
.upd-k-pdf { --upd-k: #e5484d; }
.upd-k-image { --upd-k: #2fa44f; }
.upd-k-video { --upd-k: #8e4ec6; }
.upd-k-audio { --upd-k: #d6409f; }
.upd-k-doc { --upd-k: #2b5fff; }
.upd-k-archive { --upd-k: #c58214; }
.upd-k-other { --upd-k: #6b6a63; }
.upd-file {
  position: relative; width: 40px; height: 48px; flex-shrink: 0;
  background: var(--surface-2); border: 1.5px solid var(--border-strong);
  border-radius: 6px 13px 6px 6px;
}
.upd-file::before {                                   /* esquina doblada */
  content: ''; position: absolute; top: -1.5px; right: -1.5px; width: 13px; height: 13px;
  background: linear-gradient(225deg, var(--surface) 50%, var(--border-strong) 50%);
  border-radius: 0 0 0 4px;
}
.upd-file-ext {
  position: absolute; left: -7px; bottom: 7px; max-width: 46px;
  padding: 2px 5px; border-radius: 4px;
  background: var(--upd-k); color: #fff;
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Con vista previa (foto, carátula, fotograma): miniatura redondeada con la
   misma etiqueta de extensión; aparece con un fundido al cargar. */
.upd-file.has-img { border: 0; border-radius: 10px; width: 48px; height: 48px; background: var(--surface-sunken); }
.upd-file.has-img::before { display: none; }
.upd-file img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  border-radius: 10px; opacity: 0; transition: opacity .25s ease;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.upd-file.is-loaded img { opacity: 1; }
.upd-file.has-img .upd-file-ext { bottom: 5px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.upd-main { min-width: 0; }
.upd-name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upd-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; min-width: 0; }
.upd-bytes { white-space: nowrap; }
.upd-dot { color: var(--fg-faint); font-size: 10px; }
.upd-state { display: inline-flex; align-items: center; gap: 5px; color: var(--fg); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upd-state.is-queued { color: var(--fg-muted); }
.upd-state.is-error { color: var(--danger); }
.upd-badge { display: inline-flex; flex-shrink: 0; }
.upd-badge svg { width: 15px; height: 15px; }
.upd-state.is-done .upd-badge { color: var(--success); }
.upd-spin {
  width: 13px; height: 13px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent);
  animation: upd-spin .8s linear infinite;
}
@keyframes upd-spin { to { transform: rotate(360deg); } }
.upd-act { color: var(--fg-muted); }
.upd-act svg { width: 17px; height: 17px; }
.upd-item.is-done .upd-act:hover { color: var(--danger); }

@media (max-width: 640px) {
  .upd-head { padding: 12px 14px 12px 6px; gap: 10px; }
  .upd-head-ico { width: 38px; height: 38px; }
  .upd-head-ico svg { width: 19px; height: 19px; }
  .upd-body { padding: 16px 14px calc(24px + env(safe-area-inset-bottom, 0px)); gap: 18px; }
  .upd-zone { padding: 28px 14px 22px; }
  .upd-item { column-gap: 12px; padding: 12px 8px 12px 14px; }
  .upd-meta { flex-wrap: wrap; row-gap: 2px; }       /* «Subiendo…» nunca se corta */
  .upd-act { width: 40px; height: 40px; }            /* tamaño táctil */
}
@media (prefers-reduced-motion: reduce) {
  .upd, .upd-item { animation: none; }
  .upd-spin { animation-duration: 2.4s; }
  .upd-fill { transition: none; }
}

/* Reproductor de música: widget flotante en widgets.css.
   Aquí solo queda el ecualizador de la tarjeta que está sonando. */
.fb-now i { display: block; width: 3px; border-radius: 2px; background: currentColor; height: 30%; }
.fb-now i:nth-child(2) { animation-delay: -.45s !important; }
.fb-now i:nth-child(3) { animation-delay: -.2s !important; }
.fb-now i:nth-child(4) { animation-delay: -.7s !important; }
@keyframes mp-eq { 0%, 100% { height: 25%; } 25% { height: 95%; } 50% { height: 45%; } 75% { height: 75%; } }
@media (max-width: 640px) {
  .upanel { right: 8px; left: 8px; width: auto; bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .fb-now i { animation: none !important; height: 60%; }
}

/* Tarjeta que está sonando: ecualizador animado sobre la portada */
.fb-now {
  position: absolute; z-index: 1; width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 13px 0;
  background: rgba(13, 15, 26, .78); color: #fff;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .6);
}
.fb-now i { animation: mp-eq 1s ease-in-out infinite; }
body.mp-paused .fb-now i { animation-play-state: paused; }
.fb-art.is-now-playing { box-shadow: inset 0 0 0 2px var(--accent); }

/* ─── Visor de video ─── */
.mviewer {
  position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, .9);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px;
}
.mviewer video { max-width: 100%; max-height: 78vh; border-radius: 12px; background: #000; }
.mv-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.mv-title { color: #fff; font-weight: 600; font-size: 14px; max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Sin portada: en música/video basta el botón de reproducir (sin icono debajo). */
.fb-art.fb-audio:not(.has-img) .fb-icon,
.fb-art.fb-video:not(.has-img) .fb-icon { display: none; }
/* Teléfonos: dos columnas compactas para ver muchos archivos de un vistazo. */
@media (max-width: 640px) {
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fb-art { aspect-ratio: 1 / 1; }
  .fc-body { padding: 8px 10px 10px; }
  .file-card .doc-title { font-size: 13px; }
  .file-card .card-actions { top: 6px; right: 6px; }
  .fb-play { width: 36px; height: 36px; }
  .fb-badge, .fb-dur { bottom: 6px; font-size: 10px; padding: 2px 7px; }
  .fb-badge { left: 6px; } .fb-dur { right: 6px; }
}
/* Documento de texto dentro de un proyecto: banner con el inicio del texto. */
.fb-art.fb-text { place-items: stretch; background: var(--surface); }
.fb-text-preview {
  margin: 0; padding: 48px 14px 34px; text-align: left;   /* arriba quedan los botones de la tarjeta */
  font-size: 12px; line-height: 1.5; color: var(--fg-muted);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical;
}
.fb-art.fb-text .fb-icon { display: grid; place-items: center; color: var(--accent-ink); }
@media (max-width: 640px) { .fb-text-preview { padding: 42px 10px 30px; font-size: 11px; -webkit-line-clamp: 6; } }

/* ─── Transición al cambiar de sección ───────────────────────────────────
   Los bloques de la sección nueva entran en cascada: suben (o bajan, según
   hacia dónde vayas en el menú) mientras aparecen. Lo activa main.js con la
   clase .v-anim en cada bloque; --v-from es la dirección y --v-i el turno.
   El contenedor del cuerpo no se mueve: solo sus bloques, para que haya un
   único movimiento a la vista. */
@media (prefers-reduced-motion: no-preference) {
  /* La marca va en cada bloque (main.js se la pone y se la quita). Así, si la
     sección se vuelve a dibujar porque llegaron datos, lo nuevo no anima. */
  #view .v-anim {
    animation: viewIn .46s cubic-bezier(.16, 1, .3, 1) both;
    animation-delay: calc(var(--v-i, 0) * 45ms);
  }
  @keyframes viewIn {
    from { opacity: 0; transform: translate3d(0, var(--v-from, 14px), 0); }
    to   { opacity: 1; transform: none; }
  }
}

  /* ───────── Papelera ───────── */
  .tr-list { display: flex; flex-direction: column; gap: 8px; }
  .tr-row {
    display: grid; align-items: center; gap: 12px;
    grid-template-columns: 34px minmax(0, 1.5fr) minmax(0, 1.4fr) auto auto;
    padding: 10px 12px; border-radius: 12px;
    background: var(--surface-2); border: 1px solid var(--border);
  }
  .tr-row:hover { border-color: var(--border-strong); }
  .tr-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--k, var(--fg-faint)); color: #fff; }
  .tr-ico svg { width: 17px; height: 17px; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .3)); }
  .tr-ico.is-img { background: var(--surface-sunken); overflow: hidden; }
  .tr-ico.is-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .tr-main { min-width: 0; }
  .tr-nm { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tr-sub { font-size: 11.5px; color: var(--fg-muted); margin-top: 1px; }
  .tr-from { font-size: 12px; color: var(--fg-muted); min-width: 0; }
  .tr-from span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tr-from b { font-weight: 500; color: var(--fg); }
  .tr-left { font-size: 12px; color: var(--fg-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
  .tr-left.soon { color: var(--warn); }
  .tr-acts { display: flex; gap: 6px; }
  /* Restaurar en azul y Eliminar en rojo, en claro y en oscuro. */
  .tr-btn {
    height: 32px; padding: 0 12px; border-radius: 9px;
    display: inline-flex; align-items: center; gap: 6px;
    font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
    border: 1px solid; background: transparent;
    transition: background-color .15s, border-color .15s;
  }
  .tr-btn svg { width: 14px; height: 14px; }
  .tr-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .tr-btn.is-restore {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
  }
  .tr-btn.is-restore:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); }
  .tr-btn.is-del {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 45%, transparent);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
  }
  .tr-btn.is-del:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); border-color: var(--danger); }

  /* En Android la fila se apila: nombre junto al icono, de dónde venía debajo y
     abajo los días que quedan con los dos botones a la derecha, a 40px. */
  @media (max-width: 720px) {
    .tr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 10px; padding: 11px 12px; }
    .tr-main { flex: 1 1 60%; }
    .tr-from { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 0 6px; }
    .tr-from span { white-space: nowrap; }
    .tr-from span:not(:last-child)::after { content: ' ·'; }
    .tr-left { flex: 0 1 auto; }
    .tr-acts { margin-left: auto; }
    .tr-btn { height: 44px; padding: 0 13px; border-radius: 10px; }
  }

  /* ───────── Correcciones de la revisión de diseño ───────── */
  .sk-line.w35 { width: 35%; }
  /* Huecos mientras llega la lista: ni «vacío» ni saltos al cargar. */
  .tr-row.is-sk, .pc-item.is-sk { pointer-events: none; }
  .tr-row.is-sk .tr-ico, .pc-item.is-sk .pc-ico { background: var(--surface-sunken); }
  .pc-item.is-sk { padding: 8px 8px 8px 14px; gap: 10px; }
  .pc-item.is-sk .pc-txt2 { flex: 1; }

  /* Contraste: medidos quedaban por debajo de 4.5:1 sobre el fondo de la fila.
     El azul y el rojo se mantienen, pero con el tono que sí se lee. */
  .tr-btn.is-restore { color: var(--accent-ink); }
  .tr-btn.is-del { color: color-mix(in srgb, var(--danger) 72%, #000); }
  :root[data-theme="dark"] .tr-btn.is-del { color: color-mix(in srgb, var(--danger) 60%, #fff); }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tr-btn.is-del { color: color-mix(in srgb, var(--danger) 60%, #fff); }
  }
  .tr-left.soon { color: #8a5a0a; }
  :root[data-theme="dark"] .tr-left.soon { color: var(--warn); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tr-left.soon { color: var(--warn); } }
  /* Separación entre Restaurar y Eliminar: a 6px se tocaban con el dedo. */
  @media (max-width: 720px) { .tr-acts { gap: 12px; } }

  /* ───────── Papelera: elegir varios ───────── */
  .tr-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 6px 0 10px; min-height: 40px;
  }
  .tr-head.is-sel {
    padding: 6px 12px; border-radius: 12px;
    background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  }
  .tr-all { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 2px; }
  .tr-all span {
    font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--fg-muted); font-weight: 600;
  }
  .tr-head.is-sel .tr-all span { color: var(--accent-ink); letter-spacing: .02em; text-transform: none; font-size: 13px; }
  .tr-head-acts { display: flex; gap: 8px; }
  .tr-pick { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 10px 2px 10px 0; }
  .tr-all input, .tr-pick input {
    width: 18px; height: 18px; margin: 0; cursor: pointer;
    accent-color: var(--accent); flex: none;
  }
  /* La fila elegida se marca con el filo, no con relleno: así no compite con
     el icono de color ni con los botones. */
  .tr-row.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
  .tr-row { grid-template-columns: 18px 34px minmax(0, 1.5fr) minmax(0, 1.4fr) auto auto; }
  @media (max-width: 720px) {
    .tr-head { flex-wrap: wrap; }
    .tr-head.is-sel .tr-head-acts { flex: 1 1 100%; }
    .tr-head.is-sel .tr-head-acts .tr-btn { flex: 1; justify-content: center; }
  }
  /* Eligiendo: la fila deja su columna de botones a la barra de arriba. */
  .tr-row.is-picking { grid-template-columns: 18px 34px minmax(0, 1.5fr) minmax(0, 1.4fr) auto; }
