:root {
  color-scheme: light;
  --blue: #024B79;
  --gold: #F2B705;
  --orange: #F28705;
  --red: #D90416;
  --sky: #0487D9;
  --cyan: #04B2D9;
  --black: #000000;
  --white: #FFFFFF;

  --ink: #10273a;
  --muted: #607080;
  --bg: #f5f8fb;
  --surface: #ffffff;
  --surface-soft: #eef5fa;
  --line: #d7e2ea;
  --header-shadow: 0 12px 32px rgb(2 75 121 / 18%);
  --shadow: 0 14px 36px rgb(2 75 121 / 14%);
  --card-shadow: 0 5px 16px rgb(2 75 121 / 8%);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5fbff;
  --muted: #b0c2ce;
  --bg: #07131b;
  --surface: #0d202c;
  --surface-soft: #102b3a;
  --line: #204052;
  --header-shadow: 0 14px 36px rgb(0 0 0 / 42%);
  --shadow: 0 18px 44px rgb(0 0 0 / 40%);
  --card-shadow: 0 8px 22px rgb(0 0 0 / 24%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  transition: background .25s ease, color .25s ease;
}
button, input { font: inherit; }
.wrap { width: min(1240px, calc(100% - 40px)); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: 10px; z-index: 100;
  transform: translateY(-160%); padding: 10px 14px; border-radius: 10px;
  background: var(--gold); color: var(--blue); font-weight: 900;
}
.skip-link:focus { transform: none; }

/* Cabecera municipal */
.site-header {
  position: sticky; top: 0; z-index: 30;
  color: var(--white);
  background: linear-gradient(105deg, var(--blue), color-mix(in srgb, var(--blue) 78%, var(--black)));
  border-bottom: 3px solid var(--gold);
  box-shadow: var(--header-shadow);
}
.header-inner {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(240px, 430px) auto;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; min-width: 0; }
.brand img { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 5px 8px rgb(0 0 0 / 22%)); }
.divider { height: 38px; border-left: 1px solid rgb(255 255 255 / 42%); }
.brand-copy { display: grid; gap: 1px; line-height: 1; }
.brand-copy strong { font-size: 1.24rem; letter-spacing: -.025em; white-space: nowrap; }
.brand-copy strong span { color: var(--white); }
.brand-copy strong em { color: var(--gold); font-style: normal; }
.portal-search {
  min-height: 42px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 14px;
  border: 1px solid rgb(255 255 255 / 34%);
  border-radius: 999px;
  background: rgb(0 0 0 / 13%);
  color: rgb(255 255 255 / 82%);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.portal-search:focus-within { background: rgb(0 0 0 / 22%); border-color: var(--gold); box-shadow: 0 0 0 3px rgb(242 183 5 / 22%); }
.portal-search svg { width: 19px; height: 19px; flex: 0 0 auto; }
.portal-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--white); }
.portal-search input::placeholder { color: rgb(255 255 255 / 68%); }
.portal-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .8; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.icon-button {
  width: 42px; height: 42px; display: grid; place-items: center; padding: 0;
  border: 1px solid rgb(255 255 255 / 34%); border-radius: 50%;
  background: rgb(255 255 255 / 10%); color: var(--white); cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.icon-button:hover { background: rgb(255 255 255 / 18%); border-color: var(--gold); transform: translateY(-1px); }
.icon-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-moon { display: none; }
html[data-theme="dark"] .theme-sun { display: none; }
html[data-theme="dark"] .theme-moon { display: block; }
.hero-toggle svg { width: 20px; height: 20px; }
.hero-toggle .hero-icon-show { display: none; }
html[data-hero="hidden"] .hero-toggle .hero-icon-hide { display: none; }
html[data-hero="hidden"] .hero-toggle .hero-icon-show { display: block; }
.status {
  min-height: 38px; display: inline-flex; align-items: center; gap: 8px;
  padding: 0 12px; border: 1px solid rgb(255 255 255 / 26%); border-radius: 999px;
  background: rgb(255 255 255 / 10%); color: var(--white); font-size: .78rem; font-weight: 800;
}
.status i { width: 8px; height: 8px; border-radius: 50%; }
.status-online i { background: var(--cyan); box-shadow: 0 0 0 4px rgb(4 178 217 / 22%); }
.status-offline { border-color: rgb(217 4 22 / 65%); }
.status-offline i { background: var(--red); box-shadow: 0 0 0 4px rgb(217 4 22 / 22%); }

/* Acceso institucional */
.hero { position: relative; padding: 20px 0 0; background: var(--bg); color: var(--ink); }
html[data-hero="hidden"] .hero { display: none; }
.hero .shape { display: none; }
.hero-inner {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 148px;
  display: grid; grid-template-columns: minmax(0, 1fr); align-items: center;
  padding: 18px 30px 18px 34px;
  border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 20px;
  background:
    radial-gradient(circle at 75% 38%, rgb(4 135 217 / 10%) 0 110px, transparent 111px),
    linear-gradient(110deg, var(--surface), color-mix(in srgb, var(--sky) 7%, var(--surface)));
  box-shadow: 0 8px 28px rgb(2 75 121 / 9%);
}
.hero-inner::before {
  content: ""; position: absolute; right: 54px; bottom: -33px; z-index: -1;
  width: 330px; height: 100px; opacity: .45;
  background:
    linear-gradient(90deg, transparent 0 7%, var(--sky) 7% 7.6%, transparent 7.6% 16%, var(--sky) 16% 16.7%, transparent 16.7% 27%, var(--sky) 27% 27.6%, transparent 27.6% 41%, var(--sky) 41% 41.7%, transparent 41.7% 57%, var(--sky) 57% 57.6%, transparent 57.6% 72%, var(--sky) 72% 72.7%, transparent 72.7% 86%, var(--sky) 86% 86.7%, transparent 86.7%),
    linear-gradient(var(--sky), var(--sky));
  background-size: 100% 100%, 100% 2px;
  background-position: center, center bottom;
  background-repeat: no-repeat;
  mask-image: linear-gradient(to top, #000 30%, transparent 100%);
}
.hero-copy { max-width: 720px; }
.hero-copy > b, .section-heading b { font-size: .74rem; letter-spacing: .12em; }
.hero-copy > b { color: var(--blue); }
.hero h1 {
  margin: 6px 0 9px; max-width: 760px;
  color: var(--blue); font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.02; letter-spacing: -.045em;
}
.hero h1 em { color: var(--blue); font-style: normal; }
.hero p { max-width: 620px; margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.4; }

/* Accesos rápidos */
.portal { padding: 18px 0 48px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading b { color: var(--blue); font-size: .72rem; }
.section-heading h2 { margin: 2px 0; color: var(--ink); font-size: clamp(1.55rem, 2.7vw, 2rem); line-height: 1.05; letter-spacing: -.035em; }
.section-heading p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.35; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.pill {
  min-height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: .8rem; font-weight: 800; cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
.pill:hover { border-color: var(--sky); transform: translateY(-1px); }
.pill.active { border-color: var(--blue); background: var(--blue); color: var(--white); }
.pill:disabled { opacity: .52; cursor: not-allowed; transform: none; }
.reorder-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.reorder-toggle svg { width: 16px; height: 16px; }
.reorder-help {
  margin: -2px 0 12px; padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--gold) 55%, var(--line)); border-radius: 12px;
  background: color-mix(in srgb, var(--gold) 10%, var(--surface)); color: var(--muted); font-size: .8rem; line-height: 1.35;
}
.reorder-help[hidden] { display: none; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-row-break { grid-column: 1 / -1; height: 0; margin-block: -6px; pointer-events: none; }
.grid-row-break[hidden], .grid.has-custom-order .grid-row-break { display: none; }
.card {
  --accent: var(--sky);
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 15px;
  background: var(--surface); box-shadow: var(--card-shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow); }
.card > a {
  height: 112px; min-height: 112px; display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px;
  padding: 13px 13px 11px 15px; color: var(--ink); text-decoration: none;
}
.card-icon {
  width: 39px; height: 39px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 13px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent);
}
.card-icon svg { width: 21px; height: 21px; }
.card-copy { min-width: 0; display: grid; align-content: start; gap: 3px; padding-right: 17px; }
.card-copy small { color: var(--accent); font-size: .64rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.card-copy > strong { font-size: .91rem; line-height: 1.12; }
.card-copy p {
  margin: 0; color: var(--muted); font-size: .73rem; line-height: 1.22;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.card-arrow { align-self: center; color: var(--accent); font-size: 1.05rem; }
.favorite-button {
  position: absolute; right: 7px; top: 7px; z-index: 3;
  width: 29px; height: 29px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: color-mix(in srgb, var(--gold) 75%, var(--blue)); font-size: 1.12rem; cursor: pointer;
}
.favorite-button:hover { border-color: var(--gold); }
.favorite-button.is-favorite { border-color: var(--gold); background: var(--gold); color: var(--blue); }

.speak-button {
  position: absolute; right: 7px; bottom: 7px; z-index: 3;
  width: 27px; height: 27px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--blue); cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.speak-button svg { width: 14px; height: 14px; }
.speak-button .stop-icon { display: none; width: 12px; height: 12px; }
.speak-button:hover { border-color: var(--sky); color: var(--sky); transform: translateY(-1px); }
.speak-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.speak-button.is-speaking { border-color: var(--gold); background: var(--gold); color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 20%, transparent); }
.speak-button.is-speaking .speak-icon { display: none; }
.speak-button.is-speaking .stop-icon { display: block; }
.featured .speak-button { border-color: rgb(255 255 255 / 25%); background: rgb(255 255 255 / 12%); color: var(--white); }
.featured .speak-button:hover { border-color: var(--gold); color: var(--gold); }
.featured .speak-button.is-speaking { border-color: var(--gold); background: var(--gold); color: var(--blue); }
.grid.reorder-mode .speak-button:disabled { opacity: .35; pointer-events: none; }
.accent-sky { --accent: var(--sky); }
.accent-cyan { --accent: var(--cyan); }
.accent-gold { --accent: var(--gold); }
.accent-orange { --accent: var(--orange); }
.accent-red { --accent: var(--red); }
.featured {
  --accent: var(--gold);
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), color-mix(in srgb, var(--blue) 70%, var(--black)));
}
.featured > a, .featured .card-copy strong { color: var(--white); }
.featured .card-copy small { color: var(--gold); }
.featured .card-copy p { color: rgb(255 255 255 / 72%); }
.featured .card-icon { background: var(--gold); color: var(--blue); }
.featured .card-arrow { color: var(--gold); }
.featured .favorite-button { border-color: rgb(255 255 255 / 25%); background: rgb(255 255 255 / 12%); color: var(--gold); }
.featured .favorite-button.is-favorite { border-color: var(--gold); background: var(--gold); color: var(--blue); }
.empty-state { margin-bottom: 12px; padding: 24px; border: 1px dashed var(--line); border-radius: 15px; background: var(--surface); color: var(--muted); text-align: center; }

/* Pie compacto */
.site-footer { border-top: 4px solid var(--gold); background: var(--blue); color: rgb(255 255 255 / 78%); }
.footer-inner { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.footer-brand { display: flex; align-items: center; gap: 9px; color: var(--white); font-size: .8rem; font-weight: 800; }
.footer-brand img { width: 31px; height: 31px; object-fit: contain; }
.footer-inner p { margin: 0; font-size: .76rem; }

/* Botón municipal Subir */
.back-to-top {
  position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 40;
  min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px 0 13px; border: 2px solid var(--gold); border-radius: 999px;
  background: var(--blue); color: var(--white); box-shadow: 0 13px 30px rgb(2 75 121 / 38%);
  font-size: .82rem; font-weight: 900; cursor: pointer;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease, box-shadow .18s ease;
}
.back-to-top svg { width: 20px; height: 20px; }
.back-to-top.is-visible { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-2px); box-shadow: 0 17px 34px rgb(2 75 121 / 48%); }
.back-to-top:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
html[data-theme="dark"] .back-to-top { background: var(--gold); color: var(--blue); box-shadow: 0 13px 30px rgb(0 0 0 / 55%); }

/* Orden personalizado */
.drag-handle {
  position: absolute; right: 40px; top: 7px; z-index: 4;
  width: 29px; height: 29px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--muted);
  opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.82);
  transition: opacity .16s ease, transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
  cursor: grab;
}
.drag-handle svg { width: 15px; height: 15px; }
.grid.reorder-mode .drag-handle { opacity: 1; visibility: visible; pointer-events: auto; transform: scale(1); }
.grid.reorder-mode .card { cursor: grab; touch-action: none; }
.grid.reorder-mode .card:active { cursor: grabbing; }
.grid.reorder-mode .card-copy { padding-right: 74px; }
.grid.reorder-mode .card > a { cursor: grab; }
.grid.reorder-mode .card:hover { transform: none; }
.grid.reorder-mode .favorite-button:disabled { opacity: .35; pointer-events: none; }
.drag-handle:hover { color: var(--blue); border-color: var(--sky); background: color-mix(in srgb, var(--sky) 8%, var(--surface)); }
.drag-handle:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.featured .drag-handle { border-color: rgb(255 255 255 / 28%); background: rgb(255 255 255 / 12%); color: var(--white); }
.featured .drag-handle:hover { border-color: var(--gold); color: var(--gold); }
.card.is-drag-source { opacity: .28; transform: none !important; box-shadow: none !important; border-style: dashed; }
.card-drag-ghost {
  position: fixed !important; left: 0; top: 0; z-index: 1000 !important; margin: 0 !important;
  pointer-events: none !important; opacity: .96; transform: translate3d(-9999px, -9999px, 0); will-change: transform;
  box-shadow: 0 24px 58px rgb(0 0 0 / 34%) !important; border-color: var(--gold) !important; transition: none !important;
}
.card-drag-ghost .drag-handle { opacity: 1; visibility: visible; transform: scale(1); }
.grid.reorder-mode .card.drop-before, .grid.reorder-mode .card.drop-after { outline: 2px solid var(--gold); outline-offset: 2px; }
.grid.reorder-mode .card.drop-before::after, .grid.reorder-mode .card.drop-after::after {
  content: "Soltar aquí"; position: absolute; left: 9px; right: 9px; z-index: 8;
  height: 21px; display: grid; place-items: center;
  border-radius: 7px; background: var(--gold); color: var(--blue);
  font-size: .64rem; font-weight: 950; letter-spacing: .05em; text-transform: uppercase;
  box-shadow: 0 4px 12px rgb(2 75 121 / 25%); pointer-events: none;
}
.grid.reorder-mode .card.drop-before::after { top: 4px; }
.grid.reorder-mode .card.drop-after::after { bottom: 4px; }
.grid.is-dragging .card:not(.is-drag-source) { transition: outline-color .12s ease, box-shadow .12s ease, border-color .12s ease; }
body.is-card-dragging { user-select: none; cursor: grabbing !important; overscroll-behavior: none; }
body.is-card-dragging * { cursor: grabbing !important; }

@media (max-width: 1080px) {
  .header-inner { grid-template-columns: auto minmax(210px, 1fr) auto; gap: 16px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .header-inner { grid-template-columns: 1fr auto; padding: 10px 0; }
  .portal-search { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-inner { min-height: 140px; padding-left: 25px; }
}

@media (max-width: 620px) {
  .wrap { width: min(100% - 26px, 1240px); }
  .header-inner { gap: 10px; }
  .brand img { width: 42px; height: 42px; }
  .divider { height: 34px; }
  .brand-copy strong { font-size: 1.08rem; }
  .status { min-width: 38px; width: 38px; padding: 0; justify-content: center; }
  .status span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .hero { padding-top: 14px; }
  .hero-inner { min-height: auto; grid-template-columns: 1fr; padding: 16px 18px 17px 21px; }
  .hero-inner::before { right: -60px; opacity: .25; }
  .hero h1 { font-size: clamp(1.52rem, 7.5vw, 1.95rem); }
  .hero p { padding-right: 16px; font-size: .8rem; }
  .portal { padding-top: 15px; }
  .section-heading { align-items: stretch; flex-direction: column; gap: 11px; margin-bottom: 12px; }
  .toolbar { justify-content: flex-start; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card > a { height: 104px; min-height: 104px; padding: 11px 12px 9px 14px; gap: 9px; }
  .card-copy p { -webkit-line-clamp: 2; }
  .footer-inner { min-height: 72px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 3px; padding: 11px 0; }
  .back-to-top { right: max(13px, env(safe-area-inset-right)); bottom: max(13px, env(safe-area-inset-bottom)); width: 48px; min-height: 48px; padding: 0; }
  .back-to-top span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .drag-handle { right: 39px; }
  .grid.reorder-mode .card-copy { padding-right: 72px; }
}

@media (max-width: 390px) {
  .divider { display: none; }
  .brand { gap: 8px; }
  .brand-copy strong { font-size: 1rem; }
  .header-actions { gap: 6px; }
  .icon-button { width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .card-drag-ghost { transform: none; }
}

@media (forced-colors: active) {
  .site-header, .site-footer, .featured, .back-to-top { forced-color-adjust: auto; }
  .drag-handle { border: 1px solid ButtonText; background: ButtonFace; color: ButtonText; }
  .card.is-drag-source { outline: 2px dashed Highlight; }
  .grid.reorder-mode .card.drop-before, .grid.reorder-mode .card.drop-after { outline: 3px solid Highlight; }
}

/* v2.3.0: mejoras de productividad */
search { display: block; }
.portal-search kbd {
  min-width: 24px; height: 24px; display: grid; place-items: center;
  border: 1px solid rgb(255 255 255 / 28%); border-radius: 7px;
  background: rgb(0 0 0 / 12%); color: rgb(255 255 255 / 80%);
  font-size: .68rem; font-weight: 850; line-height: 1;
}
.command-open { display: none; }

/* Recientes */
.recent-accesses {
  margin-bottom: 18px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(110deg, color-mix(in srgb, var(--gold) 8%, var(--surface)), var(--surface));
  box-shadow: var(--card-shadow);
}
.recent-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.recent-heading b { color: var(--blue); font-size: .66rem; letter-spacing: .11em; }
.recent-heading h2 { margin: 2px 0 0; font-size: 1rem; letter-spacing: -.02em; }
.text-button {
  border: 0; padding: 5px 7px; border-radius: 8px; background: transparent;
  color: var(--blue); font-size: .74rem; font-weight: 850; cursor: pointer;
}
.text-button:hover { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.text-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.recent-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.recent-item {
  min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px;
  min-height: 54px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface); color: var(--ink); text-decoration: none;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.recent-item:hover { border-color: var(--sky); transform: translateY(-1px); box-shadow: var(--card-shadow); }
.recent-item:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.recent-item .recent-icon {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px;
  background: color-mix(in srgb, var(--blue) 9%, var(--surface)); color: var(--blue);
}
.recent-item .recent-icon svg { width: 18px; height: 18px; }
.recent-item strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.recent-item small { color: var(--muted); font-size: .67rem; }
.recent-arrow { color: var(--blue); }

/* Filtro por categoría */
.category-filter { position: relative; display: inline-flex; }
.category-filter::after {
  content: "⌄"; position: absolute; right: 10px; top: 50%; transform: translateY(-56%);
  color: var(--blue); font-size: .78rem; pointer-events: none;
}
.category-filter select {
  min-height: 36px; max-width: 190px; padding: 0 29px 0 11px;
  appearance: none; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: .78rem; font-weight: 800; cursor: pointer;
}
.category-filter select:hover { border-color: var(--sky); }
.category-filter select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.reset-order { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); color: var(--red); }

/* Metadatos e indicación de red interna */
.card-meta { min-width: 0; display: flex; align-items: center; gap: 6px; }
.card-meta small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.internal-badge {
  flex: 0 0 auto; padding: 2px 5px; border: 1px solid color-mix(in srgb, var(--orange) 45%, var(--line));
  border-radius: 999px; background: color-mix(in srgb, var(--orange) 9%, var(--surface));
  color: color-mix(in srgb, var(--orange) 75%, var(--ink)); font-size: .55rem; font-weight: 900; line-height: 1.1;
}
.featured .internal-badge { border-color: rgb(255 255 255 / 32%); background: rgb(255 255 255 / 12%); color: var(--white); }

/* Estado asíncrono de disponibilidad */
.card-copy .description-emphasis { font: inherit; font-weight: 800; line-height: inherit; color: inherit; }

.site-status {
  flex: 0 0 auto; width: 12px; height: 12px; display: inline-grid; place-items: center;
  padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  line-height: 1; cursor: help;
}
.site-status i {
  width: 9px; height: 9px; display: block; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 26%, transparent);
  transition: color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.site-status.is-checking i { animation: site-status-pulse 1.15s ease-in-out infinite; }
.site-status.is-online { color: #00D965; }
.site-status.is-offline { color: var(--red); }
.site-status.is-unknown { color: var(--muted); }
.featured .site-status { color: rgb(255 255 255 / 62%); }
.featured .site-status.is-online { color: #39F28C; }
.featured .site-status.is-offline { color: #FF6B78; }
@keyframes site-status-pulse { 50% { opacity: .35; transform: scale(.72); } }

/* Menú accesible para mover tarjetas */
.card-menu-button {
  position: absolute; right: 72px; top: 7px; z-index: 5;
  width: 29px; height: 29px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted);
  opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.82); cursor: pointer;
  transition: opacity .16s ease, transform .16s ease, border-color .16s ease, color .16s ease;
}
.card-menu-button svg { width: 15px; height: 15px; }
.grid.reorder-mode .card-menu-button { opacity: 1; visibility: visible; pointer-events: auto; transform: scale(1); }
.card-menu-button:hover { color: var(--blue); border-color: var(--sky); }
.card-menu-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.featured .card-menu-button { border-color: rgb(255 255 255 / 28%); background: rgb(255 255 255 / 12%); color: var(--white); }
.grid.reorder-mode .card-copy { padding-right: 104px; }
.move-menu {
  width: min(250px, calc(100vw - 28px)); padding: 8px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  box-shadow: 0 18px 48px rgb(0 0 0 / 24%);
}
.move-menu::backdrop { background: transparent; }
.move-menu strong { display: block; padding: 7px 9px 8px; color: var(--blue); font-size: .75rem; }
.move-menu button {
  width: 100%; min-height: 36px; display: flex; align-items: center; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.move-menu button:hover, .move-menu button:focus-visible { background: color-mix(in srgb, var(--sky) 10%, var(--surface)); outline: 0; }

/* Paleta de comandos */
.command-dialog {
  width: min(680px, calc(100% - 28px)); max-height: min(78vh, 720px); padding: 0;
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink);
  box-shadow: 0 28px 90px rgb(0 0 0 / 38%); overflow: hidden;
}
.command-dialog::backdrop { background: rgb(0 20 34 / 62%); backdrop-filter: blur(5px); }
.command-shell { display: grid; gap: 12px; padding: 18px; }
.command-header { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.command-header b { color: var(--blue); font-size: .66rem; letter-spacing: .12em; }
.command-header h2 { margin: 2px 0 0; font-size: 1.35rem; letter-spacing: -.03em; }
.dialog-close {
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface-soft); color: var(--ink); cursor: pointer;
  font-size: 1.35rem; line-height: 1;
}
.dialog-close:hover { color: var(--red); border-color: var(--red); }
.dialog-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.command-search {
  min-height: 52px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 0 13px; border: 2px solid var(--blue); border-radius: 15px;
  background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 8%, transparent);
}
.command-search svg { width: 21px; height: 21px; color: var(--blue); }
.command-search input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1rem; }
.command-search kbd { padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--muted); font-size: .68rem; }
.command-results { max-height: 430px; display: grid; gap: 5px; overflow: auto; overscroll-behavior: contain; }
.command-result {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px;
  min-height: 58px; padding: 7px 10px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer;
}
.command-result:hover, .command-result.is-active { border-color: color-mix(in srgb, var(--sky) 50%, var(--line)); background: color-mix(in srgb, var(--sky) 8%, var(--surface)); }
.command-result:focus-visible { outline: 3px solid var(--gold); outline-offset: -1px; }
.command-result-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-soft); color: var(--blue); }
.command-result-icon svg { width: 20px; height: 20px; }
.command-result-copy { min-width: 0; display: grid; gap: 2px; }
.command-result-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.command-result-copy small { color: var(--muted); font-size: .7rem; }
.command-result-markers { display: flex; align-items: center; gap: 5px; color: var(--gold); font-size: .85rem; }
.command-empty { padding: 30px 16px; color: var(--muted); text-align: center; }
.command-help { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; color: var(--muted); font-size: .68rem; }

/* Actualización PWA */
.update-toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 1200;
  width: min(540px, calc(100% - 28px)); display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
  padding: 12px 12px 12px 15px; border: 1px solid var(--gold); border-radius: 16px;
  background: var(--blue); color: var(--white); box-shadow: 0 18px 54px rgb(0 0 0 / 38%);
  transform: translateX(-50%);
}
.update-toast[hidden] { display: none; }
.update-toast div { display: grid; gap: 2px; }
.update-toast strong { font-size: .82rem; }
.update-toast span { color: rgb(255 255 255 / 76%); font-size: .72rem; }
.update-primary { min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--gold); color: var(--blue); font-size: .75rem; font-weight: 900; cursor: pointer; }
.update-dismiss { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: rgb(255 255 255 / 12%); color: var(--white); cursor: pointer; font-size: 1.2rem; }
.update-primary:focus-visible, .update-dismiss:focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }

/* View Transitions progresivas */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 190ms; animation-timing-function: ease-out; }
html[data-theme="dark"]::view-transition-old(root) { z-index: 1; }
html[data-theme="dark"]::view-transition-new(root) { z-index: 999; }

@media (max-width: 1080px) {
  .recent-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .portal-search kbd { display: none; }
  .command-open { display: grid; }
}

@media (max-width: 620px) {
  .recent-accesses { padding: 12px; border-radius: 15px; }
  .recent-list { grid-template-columns: 1fr 1fr; }
  .recent-item { grid-template-columns: auto minmax(0, 1fr); }
  .recent-item small, .recent-arrow { display: none; }
  .category-filter { width: 100%; }
  .category-filter select { width: 100%; max-width: none; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .toolbar .pill { width: 100%; }
  .category-filter, .reorder-toggle, .reset-order { grid-column: span 2; }
  .card-menu-button { right: 71px; }
  .grid.reorder-mode .card-copy { padding-right: 102px; }
  .command-shell { padding: 14px; }
  .command-help { gap: 8px; }
  .update-toast { grid-template-columns: 1fr auto; }
  .update-primary { grid-row: 2; grid-column: 1 / -1; }
  .update-dismiss { grid-column: 2; grid-row: 1; }
}

@media (max-width: 390px) {
  .recent-list { grid-template-columns: 1fr; }
  .recent-item:nth-child(n+4) { display: none; }
}
.recent-item > span:nth-child(2) { min-width: 0; display: grid; gap: 1px; }
.command-dialog:not([open]) { display: none; }
.move-menu { display: none; }
.move-menu:popover-open { display: block; }
.move-menu.is-fallback-open {
  display: block; position: absolute; inset: 42px 8px auto auto; z-index: 20;
}

/* Búsqueda informativa v2.4 */
.search-feedback {
  min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: -2px 0 13px; padding: 9px 12px 9px 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line)); border-radius: 13px;
  background: color-mix(in srgb, var(--sky) 5%, var(--surface));
}
.search-feedback-copy { min-width: 0; display: grid; gap: 2px; }
.search-feedback strong { color: var(--blue); font-size: .8rem; line-height: 1.25; }
.search-feedback span { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.search-clear,
.empty-clear-search {
  flex: 0 0 auto; min-height: 32px; padding: 0 11px;
  border: 1px solid color-mix(in srgb, var(--blue) 32%, var(--line)); border-radius: 999px;
  background: var(--surface); color: var(--blue); font-size: .7rem; font-weight: 900; cursor: pointer;
}
.search-clear:hover,
.empty-clear-search:hover { border-color: var(--blue); background: color-mix(in srgb, var(--sky) 8%, var(--surface)); }
.search-clear:focus-visible,
.empty-clear-search:focus-visible,
.search-suggestion:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.card-copy mark,
.command-result-copy mark {
  padding: 0 .08em; border-radius: .22em;
  background: color-mix(in srgb, var(--gold) 58%, transparent); color: inherit;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.featured .card-copy mark { background: var(--gold); color: var(--blue); }
.search-match-reason {
  width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px; padding: 2px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 14%, var(--surface));
  color: color-mix(in srgb, var(--blue) 88%, var(--ink)); font-size: .58rem; font-weight: 850; line-height: 1.2;
}
.featured .search-match-reason { background: rgb(255 255 255 / 16%); color: var(--white); }

.empty-search-state { display: grid; justify-items: center; gap: 8px; }
.empty-search-state[hidden] { display: none; }
.empty-search-state strong { color: var(--ink); font-size: .94rem; }
.empty-search-state p { margin: 0; color: var(--muted); font-size: .78rem; }
.search-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.search-suggestion {
  min-height: 31px; padding: 0 10px; border: 1px solid color-mix(in srgb, var(--sky) 38%, var(--line));
  border-radius: 999px; background: color-mix(in srgb, var(--sky) 7%, var(--surface));
  color: var(--blue); font-size: .7rem; font-weight: 850; cursor: pointer;
}
.search-suggestion:hover { border-color: var(--blue); background: color-mix(in srgb, var(--sky) 13%, var(--surface)); }

.command-status { margin: -3px 2px 0; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.command-empty { display: grid; justify-items: center; gap: 8px; }
.command-empty strong { color: var(--ink); font-size: .9rem; }
.command-empty p { margin: 0; font-size: .74rem; }
.command-suggestions { margin-top: 3px; }

@media (max-width: 620px) {
  .search-feedback { align-items: flex-start; padding: 9px 10px; }
  .search-feedback span { display: none; }
  .search-clear { min-height: 30px; padding-inline: 9px; }
  .search-match-reason { max-width: calc(100vw - 175px); }
}

@media (prefers-reduced-motion: reduce) { .site-status.is-checking i { animation: none; } }
