/* Atlantis Portada — usa las variables de la plantilla del Ayuntamiento si existen */
.ap-hero, .ap-avisos, .ap-events, .ap-portals, .ap-services, .ap-news-wrap, .ap-projects-wrap, .ap-contact, .com-atlantisportada {
  --ap-red: var(--t-red, #ed0026);
  --ap-red-bar: var(--t-red-bar, #dd0223);
  --ap-red-text: var(--t-red-text, #b8001e);
  --ap-red-soft: var(--t-red-soft, #fde8eb);
  --ap-ink: var(--t-ink, #1f1a1a);
  --ap-ink-2: var(--t-ink-2, #4a4242);
  --ap-ink-3: var(--t-ink-3, #6b6262);
  --ap-line: var(--t-line, #e8e2e2);
  --ap-line-2: var(--t-line-2, #f0eaea);
  --ap-soft: var(--t-bg-soft, #f7f3f2);
  --ap-dark: var(--t-footer, #1f1a1a);
  --ap-nav: var(--t-nav, #333333);
  --ap-radius: var(--t-radius, 12px);
}

/* Botones y comunes ---------------------------------------------------- */
.ap-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px; text-align: center; border: 1px solid transparent; border-radius: 6px; font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; }
.ap-btn:hover, .ap-btn:focus { text-decoration: none; }
.ap-btn--primary { background: var(--ap-red-bar); color: #fff; }
.ap-btn--primary:hover, .ap-btn--primary:focus { background: var(--ap-red-text); color: #fff; }
.ap-btn--ghost { background: #fff; color: var(--ap-ink); border-color: #c9bcbc; }
.ap-btn--ghost:hover, .ap-btn--ghost:focus { border-color: var(--ap-ink); color: var(--ap-ink); }
.ap-btn--dark { background: var(--ap-nav); color: #fff; }
.ap-btn--dark:hover, .ap-btn--dark:focus { background: #111; color: #fff; }
.ap-btn--light { background: #fff; color: var(--ap-ink); }
.ap-btn--small { min-height: 38px; padding: 0 14px; font-size: 15px; }
.ap-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.ap-kicker { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ap-red-text); }
.ap-lead { margin: 0; font-size: 17px; color: var(--ap-ink-2); }
.ap-note { margin: 16px 0 0; font-size: 14px; color: var(--ap-ink-3); }
.ap-empty { padding: 18px; background: var(--ap-soft); border-radius: 10px; }
.ap-center { text-align: center; margin: 28px 0 0; }
.ap-more { margin: -8px 0 18px; text-align: right; font-weight: 700; }
@media (min-width: 768px) {
  .hsection > .container { position: relative; }
  .hsection__title + .ap-more { position: absolute; top: 4px; right: var(--t-gutter, 24px); margin: 0; }
}

/* Carrusel de destacados --------------------------------------------- */
.ap-hero { display: flex; flex-direction: column; gap: 22px; }
.ap-slide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 32px; align-items: stretch; }
.ap-slide[hidden] { display: none; }
.ap-slide__text { display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.ap-slide__title { margin: 0; font-size: clamp(30px, 4.2vw, 44px); line-height: 1.08; font-weight: 800; }
.ap-slide__lead { margin: 0; font-size: 18px; line-height: 1.55; color: var(--ap-ink-2); }
.ap-slide__media { min-height: 300px; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; background: #d9cfcc; }
.ap-slide__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-slide__media--empty { background: linear-gradient(135deg, var(--ap-red-bar) 0%, #8a0016 100%); position: relative; }
.ap-slide__media--empty::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.25), transparent 45%), repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 14px, transparent 14px 28px); }
.ap-slide.is-active .ap-slide__text, .ap-slide.is-active .ap-slide__media { animation: ap-fade .45s ease-out; }
@keyframes ap-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ap-hero__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.ap-round { width: 44px; height: 44px; border-radius: 50%; border: 1px solid #c9bcbc; background: #fff; color: var(--ap-ink); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.ap-round:hover, .ap-round:focus-visible { border-color: var(--ap-ink); }
.ap-dots { display: flex; gap: 8px; align-items: center; }
.ap-dot { width: 12px; height: 12px; padding: 0; border: 0; border-radius: 999px; background: #b3a5a5; cursor: pointer; transition: width .2s; }
.ap-dot.is-active { width: 28px; background: var(--ap-red-bar); }
.ap-pause { padding: 6px 12px; border: 1px solid #c9bcbc; border-radius: 999px; background: #fff; font: inherit; font-size: 14px; color: var(--ap-ink-2); cursor: pointer; }
.ap-hero__note { margin: 0 0 0 auto; font-size: 15px; color: var(--ap-ink-3); }
.ap-hero__note a { font-weight: 700; }
@media (max-width: 860px) {
  .ap-slide { grid-template-columns: 1fr; gap: 18px; }
  .ap-slide__media { order: -1; min-height: 0; }
  .ap-hero__note { margin: 0; width: 100%; }
}

/* Avisos ---------------------------------------------------------------- */
.ap-avisos { display: flex; flex-direction: column; gap: 12px; }
.ap-aviso { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 16px 20px; border-radius: 10px; border: 1px solid; }
.ap-aviso__icon { flex: 0 0 auto; }
.ap-aviso__body { flex: 1 1 320px; }
.ap-aviso__body p { margin: 0; }
.ap-aviso__title { font-weight: 800; font-size: 18px; }
.ap-aviso--info { background: #e8eef9; border-color: #c3d1ee; color: #1c3b70; }
.ap-aviso--aviso { background: #fff4e0; border-color: #f0d199; color: #6b4400; }
.ap-aviso--urgente { background: var(--ap-red-bar); border-color: var(--ap-red-bar); color: #fff; }
.ap-aviso--urgente .ap-btn--small { background: #fff; color: var(--ap-red-text); }
.ap-aviso .ap-btn--small { background: #fff; color: inherit; border-color: currentColor; }

/* Portales -------------------------------------------------------------- */
.ap-portals { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.ap-portal { display: flex; flex-direction: column; align-items: center; gap: 14px; height: 100%; padding: 24px 14px; border: 1px solid var(--ap-line); border-radius: var(--ap-radius); background: #fff; color: var(--ap-ink); text-align: center; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ap-portal:hover, .ap-portal:focus-visible { border-color: var(--ap-red-bar); box-shadow: 0 6px 18px rgba(31, 26, 26, .08); transform: translateY(-2px); color: var(--ap-ink); text-decoration: none; }
.ap-portal__icon { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: var(--ap-red-soft); color: var(--ap-red); }
.ap-portal__icon img { width: 40px; height: 40px; object-fit: contain; }
.ap-portal__name { font-size: 16px; font-weight: 700; line-height: 1.3; }
@media (max-width: 575px) {
  .ap-portals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ap-portal { padding: 14px 8px; gap: 8px; }
  .ap-portal__icon { width: 52px; height: 52px; }
  .ap-portal__icon svg { width: 28px; height: 28px; }
  .ap-portal__name { font-size: 15px; }
}

/* Pruebas deportivas ------------------------------------------------- */
.ap-events { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.ap-event { display: flex; flex-direction: column; border: 1px solid var(--ap-line); border-radius: 14px; overflow: hidden; background: #fff; }
.ap-event__poster { position: relative; height: 380px; overflow: hidden; background: #2a2424; }
.ap-event__backdrop { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(18px) brightness(.55); }
.ap-event__img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.ap-event__date { position: absolute; z-index: 1; top: 16px; left: 16px; padding: 6px 12px; border-radius: 999px; background: var(--ap-red); color: #fff; font-size: 14px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.ap-event__body { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px 24px; flex: 1; }
.ap-event__body .ap-btn { align-self: flex-start; margin-top: auto; }
.ap-event__title { margin: 0; font-size: 24px; font-weight: 800; }
.ap-event__state { margin: 0; padding: 16px; border-radius: 8px; background: var(--ap-soft); color: var(--ap-ink-2); font-weight: 600; text-align: center; }
.ap-countdown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ap-countdown[hidden] { display: none; }
.ap-countdown__cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 8px; background: var(--ap-dark); color: #fff; }
.ap-countdown__cell span { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ap-countdown__cell small { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #d9cfcc; }
.ap-countdown__cell--accent { background: var(--ap-red); }
.ap-countdown__cell--accent small { color: #ffe3e7; }
@media (max-width: 575px) {
  .ap-events { grid-template-columns: 1fr; }
  .ap-event__poster { height: 300px; }
  .ap-countdown__cell span { font-size: 24px; }
}

/* Trámites y servicios ------------------------------------------------ */
.ap-services { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.ap-service { display: flex; gap: 14px; align-items: flex-start; height: 100%; padding: 20px 22px; border: 1px solid var(--ap-line); border-radius: 10px; background: #fff; color: var(--ap-ink); text-decoration: none; transition: border-color .15s; }
.ap-service:hover, .ap-service:focus-visible { border-color: var(--ap-red-bar); color: var(--ap-ink); text-decoration: none; }
.ap-service__icon { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; background: var(--ap-red-soft); color: var(--ap-red); }
.ap-service__text { display: flex; flex-direction: column; gap: 4px; }
.ap-service__name { font-size: 17px; font-weight: 700; line-height: 1.3; }
.ap-service__desc { font-size: 14px; color: #5a5050; line-height: 1.4; }

/* Actualidad -------------------------------------------------------- */
.ap-news-wrap { display: grid; grid-template-columns: 1fr; gap: 40px; }
.ap-news-wrap.has-aside { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.ap-news { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.ap-news__item { display: flex; flex-direction: column; gap: 10px; }
.ap-news__img { display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: #ece5e3; }
.ap-news__img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.ap-news__item:hover .ap-news__img img { transform: scale(1.03); }
.ap-news__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ap-red-text); }
.ap-news__meta time { color: var(--ap-ink-3); }
.ap-news__title { margin: 0; font-size: 18px; line-height: 1.3; }
.ap-news__title a { color: var(--ap-ink); }
.ap-news__title a:hover, .ap-news__title a:focus { color: var(--ap-red-text); }
.ap-news__excerpt { margin: 0; font-size: 15px; color: var(--ap-ink-2); }
.ap-pubs__title { margin: 0 0 10px; font-size: 22px; font-weight: 800; }
.ap-pubs ul { margin: 0; padding: 0; list-style: none; }
.ap-pubs li a { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-top: 1px solid var(--ap-line); color: var(--ap-ink); text-decoration: none; }
.ap-pubs li a:hover .ap-pubs__name, .ap-pubs li a:focus .ap-pubs__name { color: var(--ap-red-dark, #8a0016); text-decoration: none; }
.ap-pubs__name { font-size: 17px; font-weight: 700; line-height: 1.3; }
.ap-pubs__desc { font-size: 14px; color: #5a5050; }
.ap-pubs__more a { font-weight: 700; color: var(--ap-red-text) !important; }
@media (max-width: 991px) { .ap-news-wrap.has-aside { grid-template-columns: 1fr; } }
@media (max-width: 575px) {
  .ap-news { grid-template-columns: 1fr; gap: 18px; }
  .ap-news__item { display: grid; grid-template-columns: 112px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 14px; row-gap: 4px; }
  .ap-news__img { grid-row: 1 / span 3; aspect-ratio: 1 / 1; }
  .ap-news__title { font-size: 16px; }
  .ap-news__excerpt { display: none; }
}

/* Proyectos y subvenciones ------------------------------------------ */
.ap-projects-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.ap-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-chip { display: inline-flex; align-items: center; padding: 9px 14px; border: 1px solid #c9bcbc; border-radius: 999px; background: #fff; color: var(--ap-ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.ap-chip:hover, .ap-chip:focus-visible { border-color: var(--ap-ink); color: var(--ap-ink); text-decoration: none; }
.ap-chip.is-active { background: var(--ap-nav); border-color: var(--ap-nav); color: #fff; }
.ap-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.ap-project { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--ap-line); border-radius: var(--ap-radius); background: #fff; }
.ap-project[hidden] { display: none; }
.ap-project__img { height: 190px; background: #ece5e3; }
.ap-project__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-project__body { display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 18px; flex: 1 1 auto; }
.ap-project__fund { align-self: flex-start; margin: 0; padding: 5px 10px; border-radius: 4px; background: var(--ap-nav); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ap-project__title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35; }
.ap-project__title a { color: var(--ap-ink); }
.ap-project__title a:hover, .ap-project__title a:focus { color: var(--ap-red-text); }
.ap-project__data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: auto 0 0; padding-top: 12px; border-top: 1px solid var(--ap-line-2); }
.ap-project__data div { display: flex; flex-direction: column; gap: 2px; }
.ap-project__data dt { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ap-ink-3); font-weight: 400; }
.ap-project__data dd { margin: 0; font-size: 16px; font-weight: 700; }
.ap-project__amount dd { font-weight: 800; color: var(--ap-red-text); }
.ap-project__data--big dd { font-size: 22px; }
.ap-project__logos { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 14px 22px 18px; border-top: 1px solid var(--ap-line-2); }
.ap-project__logos img { height: 44px; width: auto; max-width: 100%; object-fit: contain; }
.ap-project__logos--big { padding: 18px 0; border-top: 0; }
.ap-project__logos--big img { height: 64px; }
.ap-filter-empty { margin: 16px 0 0; }
.ap-proyecto { max-width: 860px; }
.ap-proyecto > .ap-project__fund { display: inline-block; margin-bottom: 16px; }
.ap-proyecto__img img { border-radius: 12px; }
.ap-proyecto__text { margin: 20px 0; }
.ap-back { margin-top: 24px; }
.com-atlantisportada .ap-filters { margin: 16px 0 24px; }
@media (max-width: 575px) { .ap-projects { grid-template-columns: 1fr; } }

/* Catastro + contacto ------------------------------------------------- */
.ap-contact { display: flex; flex-wrap: wrap; gap: 32px; }
.ap-contact__catastro { flex: 1 1 320px; display: flex; flex-direction: column; gap: 12px; padding: 26px; border: 1px solid var(--ap-line); border-radius: var(--ap-radius); }
.ap-contact__catastro h3 { margin: 0; font-size: 22px; }
.ap-contact__catastro p { margin: 0; color: var(--ap-ink-2); }
.ap-contact__catastro img { max-height: 110px; width: auto; object-fit: contain; align-self: flex-start; }
.ap-contact__catastro a { font-weight: 700; }
.ap-contact__card { flex: 2 1 540px; display: flex; flex-wrap: wrap; gap: 24px; padding: 26px; border-radius: var(--ap-radius); background: var(--ap-dark); color: #fff; }
.ap-contact__data { flex: 1 1 240px; display: flex; flex-direction: column; gap: 8px; }
.ap-contact__data h3 { margin: 0 0 4px; font-size: 22px; color: #fff; }
.ap-contact__data p { margin: 0; }
.ap-contact__data a { color: #fff; }
.ap-contact__phone { font-size: 22px; font-weight: 800; }
.ap-contact__data .ap-contact__link { color: #ffb3bf; font-weight: 600; }
.ap-map { flex: 1 1 260px; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; border-radius: 8px; background: #3a3131; color: #d9cfcc; font-size: 15px; text-align: center; }
.ap-map p { margin: 0; }
.ap-map.is-loaded { padding: 0; background: #e5e3df; }
.ap-map iframe { width: 100%; height: 100%; min-height: 260px; border: 0; border-radius: 8px; }
.ap-map a { color: #fff; }

/* ---------------------------------------------------------------------------
   Panel de gestión en la web (vista gestion)
--------------------------------------------------------------------------- */
.apg-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; background: var(--t-bg-soft, #f7f3f2); font-size: 13px; }
.apg-pistas { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.apg-pista { display: flex; flex-direction: column; gap: 4px; padding: 20px; border: 1px solid var(--t-line, #e8e2e2); border-radius: 12px; background: #fff; color: var(--t-ink, #1f1a1a); }
.apg-pista__name { font-weight: 800; font-size: 17px; }
.apg-pista__num { font-size: 15px; }
.apg-pista__num strong { font-size: 34px; line-height: 1; color: var(--ap-red-text, #b8001e); }
.apg-pista__sub { font-size: 14px; color: var(--t-ink-3, #6b6262); }
.apg-pista--go { justify-content: center; background: var(--t-nav, #333); border-color: var(--t-nav, #333); color: #fff; }
.apg-pista--go .apg-pista__sub { color: #d9d0d0; }
.apg-pista--go:hover { background: var(--ap-red, #dd0223); border-color: var(--ap-red, #dd0223); color: #fff; text-decoration: none; }
.apg-pista--go:hover .apg-pista__sub { color: #fff; }
.apg-item { margin-bottom: 10px; border: 1px solid var(--t-line, #e8e2e2); border-radius: 12px; background: #fff; scroll-margin-top: 20px; }
.apg-item[open] { border-color: #cfc4c4; box-shadow: 0 6px 18px rgba(31, 26, 26, .06); }
.apg-item > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 16px 20px; cursor: pointer; list-style: none; font-weight: 700; }
.apg-item > summary::-webkit-details-marker { display: none; }
.apg-item > summary::after { content: ""; width: 9px; height: 9px; margin-left: auto; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.apg-item[open] > summary::after { transform: rotate(-135deg); }
.apg-item__title { font-size: 17px; }
.apg-item--new { border-style: dashed; }
.apg-item--new > summary { color: var(--ap-red-text, #b8001e); }
.apg-plus { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ap-red, #dd0223); color: #fff; font-size: 18px; line-height: 1; }
.apg-item__body { padding: 0 20px 20px; border-top: 1px solid var(--t-line-2, #f0eaea); }
.apg-item__tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--t-line-2, #f0eaea); }
.apg-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--t-bg-soft, #f7f3f2); color: var(--t-ink-2, #4a4242); }
.apg-badge--on { background: #e3f3e8; color: #1d5a37; }
.apg-badge--off { background: #eee; color: #555; }
.apg-badge--wait { background: #e6eefb; color: #24467a; }
.apg-badge--urgente { background: #fdecee; color: #8a0016; }
.apg-badge--aviso { background: #fff4d6; color: #5c4400; }
.apg-badge--info { background: #e6eefb; color: #24467a; }
.apg-form { padding-top: 16px; }
.apg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.apg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.apg-field--wide { grid-column: 1 / -1; }
.apg-field label, .apg-field legend { font-size: 14px; font-weight: 700; padding: 0; }
.apg-when { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.apg-when legend { width: 100%; margin-bottom: 6px; }
.apg-when input { flex: 1 1 120px; width: auto; }
.apg-help { margin: 12px 0 0; font-size: 14px; color: var(--t-ink-3, #6b6262); }
.apg-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.apg-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.apg-inline { display: inline; margin: 0; }
.apg .btn.apg-danger { border-color: #b8001e; color: #b8001e; }
.apg .btn.apg-danger:hover { background: #fdecee; }
.apg-filter { max-width: 420px; margin-bottom: 14px; }
.apg-cat { margin: 18px 0 8px; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--t-ink-3, #6b6262); }
.apg-cat[hidden], .apg-contact[hidden] { display: none; }
.apg-contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr); gap: 10px 16px; margin: 0 0 10px; padding: 16px 20px 18px; border: 1px solid var(--t-line, #e8e2e2); border-radius: 12px; background: #fff; }
.apg-contact legend { float: left; width: 100%; margin: 0 0 4px; padding: 0; font-size: 17px; font-weight: 800; grid-column: 1 / -1; }
.apg textarea { min-height: 48px; }
.apg-contact .apg-field--wide { grid-column: auto; }
.apg-contact textarea { min-height: 48px; height: 48px; resize: vertical; }
.apg-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 14px 20px; border-radius: 12px; background: var(--t-nav, #333); color: #fff; box-shadow: 0 -6px 20px rgba(0, 0, 0, .12); }
@media (max-width: 900px) {
  .apg-contact { grid-template-columns: 1fr 1fr; }
  .apg-contact .apg-field--wide { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .apg-contact { grid-template-columns: 1fr; }
  .apg-item > summary { padding: 14px 16px; }
  .apg-item__body { padding: 0 16px 16px; }
}

/* Panel por secciones: tarjetas blancas sobre fondo gris, una sección a la vista */
.apg { display: flex; flex-direction: column; gap: 18px; }
.apg-hello { margin: 0; font-size: 17px; color: var(--t-ink-2, #4a4242); }
.apg-layout { display: flex; flex-direction: column; gap: 18px; padding: 18px; border-radius: 16px; background: #f3f1f1; }
.apg-panes { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.apg-card { margin: 0; border: 1px solid #e6e1e1; border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgba(31, 26, 26, .04); scroll-margin-top: 20px; }
.apg-card[hidden] { display: none; }
.apg-card > .apg-card__head { display: flex; align-items: center; gap: 10px; margin: 0; padding: 16px 22px; border-bottom: 1px solid #ece7e7; font-size: 19px; }
.apg-card > :not(.apg-card__head) { margin-left: 22px; margin-right: 22px; }
.apg-card > :last-child { margin-bottom: 22px; }
.apg-card > .apg-card__head + * { margin-top: 18px; }
.apg-info { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 8px; background: #f5f3f3; color: var(--t-ink-2, #4a4242); font-size: 15px; margin-bottom: 16px; }
.apg-info::before { content: "i"; flex: 0 0 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: #6b6262; color: #fff; font: 700 12px/18px Georgia, serif; text-align: center; }
.apg-nav a, .apg-home__card { color: var(--t-ink, #1f1a1a); text-decoration: none; }
.apg-nav a:hover, .apg-home__card:hover { text-decoration: none; }
.apg-nav__icon, .apg-home__icon { display: inline-flex; align-items: center; justify-content: center; color: var(--ap-red, #dd0223); }
.apg-nav__text { display: flex; flex-direction: column; line-height: 1.25; }
.apg-nav__title { font-weight: 800; font-size: 15px; }
.apg-nav__meta { font-size: 13px; color: var(--t-ink-3, #6b6262); }
.apg-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid #ddd5d5; border-radius: 8px; background: #fff; color: var(--t-ink, #1f1a1a); font-weight: 700; }
.apg-back:hover { border-color: var(--ap-red, #dd0223); color: var(--ap-red-text, #b8001e); text-decoration: none; }
.apg-back[hidden] { display: none; }

/* A · Pestañas */
.apg--tabs .apg-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-radius: 12px; background: #fff; border: 1px solid #e6e1e1; }
.apg--tabs .apg-nav a { flex: 1 1 180px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; }
.apg--tabs .apg-nav a:hover { background: #f7f3f2; }
.apg--tabs .apg-nav a.is-active { background: var(--t-nav, #333); color: #fff; }
.apg--tabs .apg-nav a.is-active .apg-nav__icon { color: #ff8a9b; }
.apg--tabs .apg-nav a.is-active .apg-nav__meta { color: #d9d0d0; }

/* B · Menú lateral */
.apg--side .apg-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); align-items: start; }
.apg--side .apg-nav { position: sticky; top: 16px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #e6e1e1; border-radius: 12px; background: #fff; }
.apg--side .apg-nav a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-left: 4px solid transparent; }
.apg--side .apg-nav a + a { border-top: 1px solid #f0eaea; }
.apg--side .apg-nav a:hover { background: #f7f3f2; }
.apg--side .apg-nav a.is-active { border-left-color: var(--ap-red, #dd0223); background: #fdecee; }
@media (max-width: 860px) {
  .apg--side .apg-layout { grid-template-columns: 1fr; }
  .apg--side .apg-nav { position: static; flex-direction: row; overflow-x: auto; }
  .apg--side .apg-nav a { flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent; }
  .apg--side .apg-nav a + a { border-top: 0; }
  .apg--side .apg-nav a.is-active { border-bottom-color: var(--ap-red, #dd0223); }
}

/* C · Inicio con tarjetas */
.apg-home { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 18px; border-radius: 16px; background: #f3f1f1; }
.apg-home[hidden] { display: none; }
.apg-home__card { display: flex; flex-direction: column; gap: 6px; padding: 22px; border: 1px solid #e6e1e1; border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.apg-home__card:hover { border-color: var(--ap-red, #dd0223); box-shadow: 0 8px 22px rgba(31, 26, 26, .08); }
.apg-home__icon { width: 52px; height: 52px; margin-bottom: 6px; border-radius: 12px; background: var(--t-red-soft, #fde8eb); }
.apg-home__title { font-size: 18px; font-weight: 800; }
.apg-home__desc { font-size: 14px; color: var(--t-ink-2, #4a4242); }
.apg-home__meta { margin-top: auto; padding-top: 10px; font-size: 14px; font-weight: 700; color: var(--ap-red-text, #b8001e); }
.apg--cards .apg-layout:has(.apg-card:not([hidden])) { display: flex; }
.apg--cards .apg-layout:not(:has(.apg-card:not([hidden]))) { display: none; }
