/* ── Tokens semánticos (inspirados en Arc): los componentes usan roles, no colores crudos ── */
  :root {
    color-scheme: light;
    --background: #fafaf9;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-muted: #f4f4f5;
    --foreground: #18181b;
    --text-secondary: #52525b;
    --text-muted: #8b8b94;
    --border: #e4e4e7;
    --border-subtle: #eeeef0;
    --border-strong: #d1d1d6;
    --accent: #5b5bd6;
    --accent-strong: #4a4ac0;
    --accent-subtle: #ededfc;
    --on-accent: #ffffff;
    --danger: #dc2626;
    --success: #16a34a;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .05);
    --shadow-md: 0 6px 20px -6px rgb(0 0 0 / .14), 0 2px 6px rgb(0 0 0 / .05);
    --ease: cubic-bezier(.2, .7, .2, 1);
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --background: #09090b;
    --surface: #131316;
    --surface-raised: #1a1a1e;
    --surface-muted: #202025;
    --foreground: #f4f4f5;
    --text-secondary: #b4b4bd;
    --text-muted: #7c7c86;
    --border: #2a2a30;
    --border-subtle: #1f1f24;
    --border-strong: #3a3a42;
    --accent: #8b8bf0;
    --accent-strong: #a5a5f5;
    --accent-subtle: #23233f;
    --on-accent: #0b0b1a;
    --danger: #f87171;
    --success: #4ade80;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 8px 24px -8px rgb(0 0 0 / .7), 0 2px 6px rgb(0 0 0 / .4);
  }

  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html { -webkit-text-size-adjust: 100%; }
  body { margin: 0; font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--background); color: var(--foreground); -webkit-font-smoothing: antialiased; transition: background .2s, color .2s; }
  svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* ── Botones ── */
  button { font: inherit; border: 0; cursor: pointer; color: inherit; background: none; transition: background .15s, color .15s, transform .1s, box-shadow .15s; }
  button:active { transform: scale(.97); }
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm); font-weight: 500; }
  .btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
  .btn.primary:hover { background: var(--accent-strong); }
  .btn.secondary { background: var(--surface-muted); color: var(--foreground); }
  .btn.secondary:hover { background: var(--border); }
  .btn.danger { background: var(--danger); color: #fff; }
  .icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--text-secondary); }
  .icon-btn:hover { background: var(--surface-muted); color: var(--foreground); }
  .icon-btn:disabled { opacity: .35; pointer-events: none; }

  /* ── Campos ── */
  .field { position: relative; display: flex; align-items: center; }
  .field > svg.i { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; }
  .field input { padding-left: 38px; }
  input { font: inherit; width: 100%; height: 40px; padding: 0 12px; color: var(--foreground); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; }
  input::placeholder { color: var(--text-muted); }
  input:hover { border-color: var(--border-strong); }
  input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
  input[type="date"] { width: auto; height: 36px; font-size: 13px; }
  kbd { position: absolute; right: 10px; font: 11px ui-monospace, monospace; color: var(--text-muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface-muted); pointer-events: none; }
  .field input:focus ~ kbd, .field input:not(:placeholder-shown) ~ kbd { display: none; }

  /* ── Control segmentado ── */
  .seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-muted); border-radius: 10px; }
  .seg button { height: 30px; padding: 0 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
  .seg button:hover { color: var(--foreground); }
  .seg button[aria-pressed="true"] { background: var(--surface-raised); color: var(--foreground); box-shadow: var(--shadow-sm); }
  :root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--border); }

  /* ── Logo ── */
  .logo { display: block; height: 26px; width: auto; mix-blend-mode: multiply; }
  .logo.lg { height: 44px; margin: 0 auto; }
  :root[data-theme="dark"] .logo { filter: invert(1); mix-blend-mode: screen; }

  /* ── Header ── */
  header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--background) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border-subtle); }
  header .field { flex: 1; max-width: 520px; margin: 0 auto; }

  /* ── Layout ── */
  main { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }
  nav { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 88px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
  .nav-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 0 10px 6px; }
  nav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .15s, color .15s; user-select: none; }
  nav a:hover { background: var(--surface-muted); color: var(--foreground); }
  nav a[aria-current="true"] { background: var(--accent-subtle); color: var(--accent-strong); font-weight: 600; }

  /* ── Barra de filtros ── */
  #filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
  #filters .spacer { flex: 1; }
  .period-nav { display: inline-flex; align-items: center; gap: 2px; }
  .range { font-size: 13px; font-weight: 500; color: var(--text-secondary); min-width: 0; padding: 0 4px; white-space: nowrap; }
  #activeTag { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 999px; background: var(--accent-subtle); color: var(--accent-strong); font-size: 13px; font-weight: 500; }
  #activeTag button { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
  #activeTag button:hover { background: var(--accent); color: var(--on-accent); }

  /* ── Añadir ── */
  #add { display: flex; gap: 8px; margin-bottom: 20px; }
  #add .field { flex: 1; }

  /* ── Tarjetas ── */
  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
  .card { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; animation: rise .35s var(--ease) both; }
  .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } }
  .cover { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 8; background: linear-gradient(135deg, var(--accent-subtle), var(--surface-muted)); overflow: hidden; flex: none; }
  .cover img.hero { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .cover img.fav { width: 28px; height: 28px; border-radius: 6px; }
  .body { display: flex; flex-direction: column; gap: 6px; padding: 12px; flex: 1; min-width: 0; }
  .domain { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); min-width: 0; }
  .domain span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .title { color: var(--foreground); font-weight: 600; font-size: 14px; line-height: 1.35; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .title::after { content: ""; position: absolute; inset: 0; } /* toda la tarjeta es clicable */
  .summary { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .summary.pending { color: transparent; background: linear-gradient(90deg, var(--surface-muted) 25%, var(--border) 50%, var(--surface-muted) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 6px; user-select: none; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .tags { display: flex; flex-wrap: wrap; gap: 4px; position: relative; z-index: 1; }
  .tag { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--surface-muted); color: var(--text-secondary); cursor: pointer; transition: background .15s, color .15s; }
  .tag:hover { background: var(--accent-subtle); color: var(--accent-strong); }
  .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; font-size: 12px; color: var(--text-muted); }
  .badge { display: inline-flex; align-items: center; max-width: 100%; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-subtle); color: var(--accent-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .meta .when { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .acts { display: flex; gap: 2px; position: relative; z-index: 1; }
  .act { width: 28px; height: 28px; opacity: 0; }
  .card:hover .act, .card:focus-within .act { opacity: 1; }
  @media (hover: none) { .act { opacity: 1; } }
  .act.del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
  .card[draggable="true"] { cursor: grab; }
  .card.dragging { opacity: .45; }
  nav a.drop { background: var(--accent-subtle); color: var(--accent-strong); outline: 2px dashed var(--accent); outline-offset: -2px; }

  /* Vista lista */
  .rows { display: flex; flex-direction: column; gap: 8px; }
  .rows .card { flex-direction: row; }
  .rows .card:hover { transform: none; }
  .rows .cover { width: 96px; aspect-ratio: auto; min-height: 84px; }
  .rows .body { padding: 10px 14px; gap: 2px; }
  .rows .summary { -webkit-line-clamp: 1; }
  .rows .meta { padding-top: 2px; margin-top: 0; justify-content: flex-start; gap: 12px; }
  .rows .meta .acts { margin-left: auto; }

  /* Skeleton + estado vacío */
  .skel { height: 210px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-muted) 25%, var(--border-subtle) 50%, var(--surface-muted) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
  .rows .skel { height: 84px; }
  .empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 6px; padding: 56px 16px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-secondary); }
  .empty .ring { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-subtle); color: var(--accent-strong); margin-bottom: 4px; }
  .empty .ring svg.i { width: 22px; height: 22px; }
  .empty strong { color: var(--foreground); font-size: 15px; }
  .empty span { font-size: 13px; color: var(--text-muted); }

  /* ── Resumen ── */
  .tabs { margin-bottom: 16px; }
  .count { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
  nav a[aria-current="true"] .count { color: var(--accent-strong); }
  .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
  .kpi { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
  .kpi .label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
  .kpi .value { margin-top: 4px; font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kpi .value.sm { font-size: 18px; line-height: 1.6; }
  .panel { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 16px; }
  .panel h2 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
  .panel h2 span { font-weight: 400; color: var(--text-muted); margin-left: 6px; }
  .bars { display: flex; flex-direction: column; gap: 4px; }
  .bar { display: grid; grid-template-columns: minmax(90px, 200px) 1fr 84px; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); text-align: left; }
  .bar:hover { background: var(--surface-muted); }
  .bar .name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bar .track { display: block; height: 10px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
  .bar:hover .track { background: var(--border); }
  .bar .fill { display: block; min-width: 4px; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; animation: grow .6s var(--ease) both; }
  @keyframes grow { from { transform: scaleX(0); } }
  .bar .num { font-size: 13px; text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
  .bar .num b { color: var(--foreground); font-weight: 600; }
  .tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }
  .tagcloud .tag { font-size: 13px; padding: 4px 10px; }
  .tagcloud .tag b { margin-left: 6px; font-weight: 600; color: var(--foreground); }

  /* ── Paginación ── */
  #pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; }
  #pager .info { flex: 1 0 100%; text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
  #pager button { min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
  #pager button:hover:not(:disabled) { background: var(--surface-muted); color: var(--foreground); }
  #pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  #pager button:disabled { opacity: .4; pointer-events: none; }
  #pager .gap { color: var(--text-muted); padding: 0 2px; }

  /* ── Edición ── */
  #editForm .fld { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
  #editForm label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
  #editForm .hint { font-size: 12px; color: var(--text-muted); }
  #editForm input { padding-left: 12px; }

  /* ── Exportar ── */
  .export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 14px; margin-bottom: 18px; }
  .export-grid .fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .export-grid label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
  .export-grid input[type="date"] { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; height: 40px; font-size: 14px; -webkit-appearance: none; appearance: none; }
  .export-grid input[type="date"]::-webkit-date-and-time-value { text-align: left; }
  select { font: inherit; width: 100%; height: 40px; padding: 0 12px; color: var(--foreground); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
  select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
  .export-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
  .export-count { font-size: 14px; color: var(--text-secondary); }
  .export-count b { color: var(--foreground); font-size: 18px; font-variant-numeric: tabular-nums; }
  .cols-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
  .cols-list code { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-muted); color: var(--text-secondary); }
  .panel .note { margin: 0 0 14px; font-size: 13px; color: var(--text-muted); }

  /* ── Administrar colecciones ── */
  .admin-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
  .admin-bar p { margin: 0; flex: 1; min-width: 200px; font-size: 13px; color: var(--text-muted); }
  .btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
  .btn:disabled { opacity: .45; pointer-events: none; }
  .arow { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); }
  .arow:hover { background: var(--surface-muted); }
  .arow .nm { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .arow .cnt { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
  .arow input[type="checkbox"] { width: 18px; height: 18px; padding: 0; accent-color: var(--accent); cursor: pointer; }
  .arow .edit { display: flex; gap: 6px; grid-column: 2 / 4; }
  .arow .edit input { height: 34px; }
  #dlgInput { margin-top: 14px; padding-left: 12px; }
  #dlgChips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; max-height: 160px; overflow-y: auto; }
  #dlgChips button { font-size: 13px; font-weight: 500; padding: 5px 12px; border-radius: 999px; background: var(--surface-muted); color: var(--text-secondary); }
  #dlgChips button:hover { background: var(--accent-subtle); color: var(--accent-strong); }
  #dlgChips button:disabled { opacity: .4; pointer-events: none; }

  /* ── Login ── */
  #login { display: grid; justify-items: center; align-content: start; min-height: 100vh; padding: clamp(24px, 12vh, 120px) 16px 16px; }
  .login-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; padding: 32px 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
  .login-card p { margin: 0; text-align: center; font-size: 14px; color: var(--text-secondary); }
  .login-card code { background: var(--surface-muted); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
  .login-card input { padding-left: 12px; }
  #loginErr { text-align: left; font-size: 13px; line-height: 1.5; color: var(--foreground); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border)); border-radius: var(--radius); padding: 12px 14px; }
  #loginErr:empty { display: none; }
  .lang-btn { width: auto; min-width: 36px; padding: 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
  .login-lang { align-self: center; padding: 4px 10px; font-size: 13px; color: var(--text-secondary); background: transparent; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
  .login-lang:hover { color: var(--foreground); border-color: var(--border-strong); }
  .login-back { text-align: center; font-size: 13px; color: var(--text-muted); text-decoration: none; }
  .login-back:hover { color: var(--foreground); text-decoration: underline; }
  .login-help { font-size: 13px; color: var(--text-secondary); text-align: center; }
  .login-help summary { cursor: pointer; display: inline-block; color: var(--accent); font-weight: 600; }
  .login-help summary:hover { text-decoration: underline; }
  .login-help[open] summary { margin-bottom: 10px; }
  .login-help ol { margin: 0 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; text-align: left; line-height: 1.5; }
  .login-help code { background: var(--surface-muted); padding: 0 5px; border-radius: 5px; font-size: 12px; }
  .login-help a { color: var(--accent); font-weight: 600; text-decoration: underline; }
  .login-help small { display: block; text-align: left; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
  #loginErr strong { display: block; margin-bottom: 4px; color: var(--danger); font-size: 14px; }
  #loginErr p { margin: 0 0 8px; text-align: left; }
  #loginErr ol { margin: 0 0 8px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
  #loginErr code { background: var(--surface-muted); padding: 0 5px; border-radius: 5px; font-size: 12px; }
  #loginErr a { color: var(--accent); font-weight: 600; text-decoration: underline; }
  #loginErr small { display: block; color: var(--text-muted); font-size: 12px; }

  /* ── Diálogo y toast ── */
  dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; background: var(--surface-raised); color: var(--foreground); box-shadow: var(--shadow-md); width: min(400px, calc(100vw - 32px)); }
  dialog::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
  dialog[open] { animation: pop .2s var(--ease); }
  @keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
  .dlg-body { padding: 22px 22px 16px; }
  .dlg-body h2 { margin: 0 0 6px; font-size: 17px; }
  .dlg-body p { margin: 0; font-size: 14px; color: var(--text-secondary); overflow-wrap: anywhere; }
  .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
  #toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
  .toast { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--foreground); color: var(--background); font-size: 14px; box-shadow: var(--shadow-md); animation: pop .25s var(--ease); }
  .toast.err svg.i { color: var(--danger); }

  /* ── Responsive ── */
  @media (max-width: 900px) { main { grid-template-columns: 160px minmax(0, 1fr); gap: 18px; } }
  @media (max-width: 700px) {
    header { flex-wrap: wrap; gap: 8px; }
    header .field { order: 3; flex: 1 0 100%; max-width: none; }
    #theme { margin-left: auto; }
    kbd { display: none; }
    main { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 12px max(12px, env(safe-area-inset-right)) 32px max(12px, env(safe-area-inset-left)); }
    nav { position: static; max-height: none; flex-direction: row; gap: 6px; overflow-x: auto; margin: 0 -12px; padding: 0 12px 4px; scrollbar-width: none; }
    nav::-webkit-scrollbar { display: none; }
    .nav-title { display: none; }
    nav a { flex: none; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; background: var(--surface); }
    nav a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
    input { font-size: 16px; } /* evita el zoom automático en iOS */
    #filters .spacer { display: none; }
    #filters .seg.periods { flex: 1 0 100%; }
    #filters .seg.periods button { flex: 1; padding: 0 6px; }
    #filters .seg.views { margin-left: auto; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .body { padding: 10px; }
    .rows .cover { width: 72px; min-height: 72px; }
    .meta .when { flex-wrap: wrap; gap: 4px; }
    .btn.label-hide span { display: none; }
  }
  @media (max-width: 700px) { .bar { grid-template-columns: minmax(70px, 110px) 1fr 70px; gap: 8px; } .panel { padding: 14px; } }
  @media (max-width: 360px) { .grid { grid-template-columns: 1fr; } }
  @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

  #clearTag svg { width: 12px; height: 12px; }
