/* ==========================================================================
   Internet Connection S.R.L. — Oficina virtual
   Solo lo propio del panel. Se carga después de styles.css y reutiliza sus
   variables, botones, campos de formulario, chips y el interruptor de tema.
   ========================================================================== */

:root {
  --side-w: 264px;
  --top-h: 72px;

  /* Estados (además de --ok-* y --bad-* de styles.css) */
  --amber-bg: #fff3d6;
  --amber-ink: #8a5a00;
  --violet-bg: #efe8ff;
  --violet-ink: #5b3db5;
  --info-bg: var(--sky-100);
  --info-ink: var(--blue-600);
}
:root[data-theme="dark"] {
  --amber-bg: rgba(255, 181, 38, 0.16);
  --amber-ink: #ffc85c;
  --violet-bg: rgba(151, 117, 250, 0.18);
  --violet-ink: #c3b1ff;
}

/* El atributo hidden manda siempre: lo usan los bloques data-if y los filtros,
   y sin esto cualquier regla display:flex o grid lo anularía. */
[hidden] { display: none !important; }

/* ---------- Carcasa ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.app__main { min-width: 0; display: flex; flex-direction: column; }

.side {
  position: sticky; top: 0; z-index: 110; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1.1rem; padding: 1.4rem 1rem 1rem;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950)); color: var(--sky-200);
}
:root[data-theme="dark"] .side { border-right: 1px solid var(--line); }
.side__brand { display: block; padding: 0.2rem 0.6rem 0.5rem; }
.side__brand img { height: 34px; width: auto; }
.side__label { margin: 0; padding: 0 0.8rem; font-family: var(--font-head); font-weight: 700; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(207, 224, 255, 0.6); }
.side__nav { display: grid; gap: 0.2rem; }
.side__link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.72rem 0.8rem; border-radius: 12px;
  font-family: var(--font-head); font-weight: 600; font-size: 0.93rem; color: var(--sky-200);
  transition: background-color 0.2s, color 0.2s;
}
.side__link i { font-size: 1.3rem; color: var(--sky-300); transition: color 0.2s; }
.side__link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side__link.is-active { background: #fff; color: var(--navy-900); }
.side__link.is-active i { color: #1c5fd4; }
.side__badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--gold-500); color: #3d2a00; font-size: 0.72rem; font-weight: 800; display: grid; place-items: center; }
.side__badge:empty { display: none; }
.side__help { margin-top: auto; padding: 1rem; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); font-size: 0.88rem; line-height: 1.45; }
.side__help strong { display: block; font-family: var(--font-head); color: #fff; }
.side__open { display: flex; align-items: center; gap: 0.45rem; margin: 0.45rem 0 0.8rem; font-size: 0.8rem; }
.side__logout { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; border-radius: 12px; color: var(--sky-300); font-weight: 600; font-size: 0.9rem; }
.side__logout:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side__logout i { font-size: 1.2rem; }
.side-backdrop { display: none; }

.top {
  position: sticky; top: 0; z-index: 80; height: var(--top-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 3vw, 2rem);
  background: var(--header-bg); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top__title { min-width: 0; }
.top__title h1 { margin: 0; font-size: 1.35rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top__title p { margin: 0; font-size: 0.85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top__actions { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; flex: none; }
.service-pill { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.42rem 0.85rem; border-radius: 999px; background: var(--ok-bg); color: var(--ok-ink); font-weight: 700; font-size: 0.82rem; white-space: nowrap; }
.service-pill .status-dot { background: var(--ok); }
.icon-btn { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.25rem; display: grid; place-items: center; cursor: pointer; transition: border-color 0.2s, background-color 0.2s; }
.icon-btn:hover { border-color: var(--tint-300); }
.icon-btn__count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #c9462f; color: #fff; font-family: var(--font-body); font-size: 0.7rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.icon-btn__count:empty { display: none; }
.top__menu { display: none; }
.user-chip { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.9rem 0.3rem 0.3rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); transition: border-color 0.2s; }
.user-chip:hover { border-color: var(--tint-300); }
.user-chip .avatar { width: 36px; height: 36px; font-size: 0.8rem; }
.user-chip strong { display: block; font-family: var(--font-head); font-size: 0.88rem; color: var(--ink); line-height: 1.15; }
.user-chip div span { font-size: 0.75rem; color: var(--muted); }

.view { width: 100%; max-width: 1240px; margin-inline: auto; padding: clamp(1.1rem, 3vw, 2rem); display: grid; gap: 1.25rem; align-content: start; outline: none; }

/* Entrada del contenido al cargar cada página */
@media (prefers-reduced-motion: no-preference) {
  .view > * { animation: view-in 0.5s var(--ease) both; }
  .view > *:nth-child(2) { animation-delay: 0.06s; }
  .view > *:nth-child(3) { animation-delay: 0.12s; }
  .view > *:nth-child(n + 4) { animation-delay: 0.18s; }
}
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Rejillas y tarjetas ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 1.25rem; align-content: start; }

.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.35rem; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card__title { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; }
.card__title i { font-size: 1.3rem; color: var(--blue-600); }
.card__lead { color: var(--muted); font-size: 0.95rem; margin: -0.5rem 0 1rem; }
.card__tools { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.card .link-arrow { font-size: 0.88rem; }
.card--navy { position: relative; overflow: hidden; border-color: transparent; background: linear-gradient(140deg, var(--navy-800), var(--navy-900) 55%, var(--navy-950)); color: var(--sky-200); }
:root[data-theme="dark"] .card--navy { border-color: rgba(92, 155, 255, 0.3); }
.card--navy > * { position: relative; }
.card--navy .arcs { position: absolute; color: rgba(255, 255, 255, 0.07); width: 300px; right: -70px; top: -90px; }

a.card--link { display: block; transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.25s; }
a.card--link:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--tint-300); }

.tile { display: flex; align-items: center; gap: 0.9rem; }
.tile__icon { flex: none; width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 1.5rem; background: var(--sky-100); color: var(--blue-600); }
.tile__label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.tile__value { display: block; font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; color: var(--ink); line-height: 1.25; }
.tile__hint { display: block; font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile > div { min-width: 0; }

/* ---------- Chips de estado ---------- */
.status { display: inline-flex; align-items: center; gap: 0.38rem; padding: 0.28rem 0.7rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; line-height: 1.3; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--ok { background: var(--ok-bg); color: var(--ok-ink); }
.status--warn { background: var(--amber-bg); color: var(--amber-ink); }
.status--info { background: var(--info-bg); color: var(--info-ink); }
.status--hold { background: var(--violet-bg); color: var(--violet-ink); }
.status--bad { background: var(--bad-bg); color: var(--bad-ink); }
.status--muted { background: var(--sky-50); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Factura pendiente ---------- */
.due__top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.due__label { font-family: var(--font-head); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sky-300); }
.due__amount { margin: 0.5rem 0 0.2rem; font-family: var(--font-head); font-weight: 900; font-style: italic; font-size: clamp(2.4rem, 5vw, 3.3rem); line-height: 1; letter-spacing: -0.03em; color: #fff; }
.due__meta { margin: 0; font-size: 0.98rem; }
.due__meta strong { color: #fff; }
.due__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; }
.due--clear .due__amount { font-size: clamp(1.8rem, 4vw, 2.4rem); font-style: normal; font-weight: 800; }

.cycle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.cycle__step { position: relative; padding-top: 0.9rem; font-size: 0.78rem; line-height: 1.3; color: var(--sky-300); }
.cycle__step::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); }
.cycle__step.is-done::before { background: var(--blue-400); }
.cycle__step.is-now::before { background: var(--gold-500); }
.cycle__step strong { display: block; font-family: var(--font-head); font-size: 0.9rem; color: #fff; }

.svc__speed { display: flex; align-items: flex-end; gap: 0.5rem; font-family: var(--font-head); color: var(--ink); }
.svc__speed strong { font-size: 3.4rem; font-weight: 900; font-style: italic; line-height: 0.85; letter-spacing: -0.05em; }
.svc__speed span { font-weight: 800; font-size: 1.1rem; padding-bottom: 0.15rem; }
.svc__plan { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.95rem; }
.svc__plan strong { color: var(--ink); }
.svc__actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }

/* ---------- Listas ---------- */
.list { display: grid; }
.list__item { display: flex; align-items: flex-start; gap: 0.9rem; width: 100%; padding: 0.9rem 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; color: inherit; cursor: pointer; }
.list__item:last-child { border-bottom: 0; padding-bottom: 0; }
.list__item:first-child { padding-top: 0; }
div.list__item { cursor: default; }
.list__icon { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; background: var(--sky-100); color: var(--blue-600); }
.list__body { min-width: 0; flex: 1; }
.list__body strong { display: block; font-family: var(--font-head); font-size: 0.95rem; color: var(--ink); line-height: 1.3; }
.list__body span { display: block; font-size: 0.9rem; color: var(--text); line-height: 1.45; }
.list__meta { flex: none; font-size: 0.78rem; color: var(--muted); white-space: nowrap; padding-top: 0.15rem; }
.list__item.is-unread .list__body strong::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 0.45rem; border-radius: 50%; background: var(--gold-500); vertical-align: middle; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.quick__btn { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 1rem; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font-family: var(--font-head); font-weight: 700; font-size: 0.9rem; text-align: left; line-height: 1.25; cursor: pointer; transition: border-color 0.2s, background-color 0.2s, transform 0.3s var(--ease); }
.quick__btn i { font-size: 1.5rem; color: var(--blue-600); }
.quick__btn:hover { border-color: var(--primary); background: var(--sky-100); transform: translateY(-2px); }

.notice { display: flex; align-items: flex-start; gap: 0.8rem; padding: 0.95rem 1.1rem; border-radius: var(--r-sm); background: var(--info-bg); color: var(--ink); font-size: 0.95rem; line-height: 1.45; }
.notice > i { flex: none; font-size: 1.35rem; color: var(--info-ink); margin-top: 0.05rem; }
.notice strong { font-family: var(--font-head); }
.notice__body { flex: 1; min-width: 0; }
.notice--warn { background: var(--amber-bg); }
.notice--warn > i { color: var(--amber-ink); }
.notice--ok { background: var(--ok-bg); }
.notice--ok > i { color: var(--ok-ink); }
.notice .btn { flex: none; align-self: center; }
.notice + .notice { margin-top: 0.7rem; }
.hint--spaced { margin-top: 0.8rem; }

.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty i { font-size: 2.4rem; color: var(--tint-300); }
.empty p { margin: 0.4rem 0 0; }

/* ---------- Filtros y tablas ---------- */
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 0.45rem 0.95rem; font-weight: 600; font-size: 0.86rem; cursor: pointer; transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
.filter:hover { border-color: var(--tint-300); }
.filter.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--xs { padding: 0.5rem 0.85rem; font-size: 0.8rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.table { width: 100%; border-collapse: collapse; }
.table th { padding: 0.7rem 0.9rem; text-align: left; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.95rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td strong { display: block; font-family: var(--font-head); font-size: 0.95rem; color: var(--ink); }
.table td small { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; }
.table__actions { display: flex; gap: 0.4rem; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Membresía ---------- */
.plan-now { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.plan-now__speed { font-family: var(--font-head); font-weight: 900; font-style: italic; font-size: 4.2rem; line-height: 0.85; letter-spacing: -0.05em; color: #fff; }
.plan-now__speed small { display: block; font-size: 1rem; font-style: normal; font-weight: 800; letter-spacing: 0; color: var(--blue-400); margin-top: 0.4rem; }
.plan-now__info { flex: 1; min-width: 12rem; }
.plan-now__info h2 { color: #fff; font-size: 1.5rem; margin-bottom: 0.2rem; }
.plan-now__info p { margin: 0; }
.plan-now__price { font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; color: #fff; white-space: nowrap; }
.plan-now__price small { font-size: 0.85rem; font-weight: 600; color: var(--sky-300); }
.perks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; margin-top: 1.3rem; padding-top: 1.2rem; border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 0.9rem; font-weight: 600; color: #fff; }
.perks li { display: inline-flex; align-items: center; gap: 0.4rem; }
.perks i { color: var(--blue-400); font-size: 1.15rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.1rem 1.5rem; }
.fact small { display: block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.fact strong { font-family: var(--font-head); font-size: 0.98rem; color: var(--ink); line-height: 1.35; }

.plan-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.plan-opt { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.2rem; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--bg); }
.plan-opt.is-current { border-color: var(--primary); background: var(--sky-50); }
.plan-opt__top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.plan-opt__top strong { font-family: var(--font-head); color: var(--ink); }
.plan-opt__speed { font-family: var(--font-head); font-weight: 900; font-style: italic; font-size: 2.6rem; line-height: 1; letter-spacing: -0.04em; color: var(--ink); }
.plan-opt__speed span { font-size: 0.95rem; font-style: normal; font-weight: 800; letter-spacing: 0; }
.plan-opt p { margin: 0; font-size: 0.9rem; color: var(--muted); flex: 1; }
.plan-opt__price { font-family: var(--font-head); font-weight: 800; color: var(--ink); }
.plan-opt__price small { font-weight: 600; color: var(--muted); }

.manage { display: flex; align-items: center; gap: 1rem; padding: 0.95rem 0; border-bottom: 1px solid var(--line); }
.manage:first-child { padding-top: 0; }
.manage:last-child { border-bottom: 0; padding-bottom: 0; }
.manage__body { flex: 1; min-width: 0; }
.manage__body strong { display: block; font-family: var(--font-head); font-size: 0.95rem; color: var(--ink); }
.manage__body span { font-size: 0.88rem; color: var(--muted); line-height: 1.4; display: block; }

.events { position: relative; display: grid; gap: 1.1rem; padding-left: 1.5rem; }
.events::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--tint-200); }
.event { position: relative; }
.event::before { content: ""; position: absolute; left: calc(-1.5rem + 0px); top: 0.35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); }
.event small { display: block; font-size: 0.78rem; font-weight: 700; color: var(--blue-600); }
.event strong { display: block; font-family: var(--font-head); font-size: 0.95rem; color: var(--ink); }
.event span { font-size: 0.88rem; color: var(--muted); }

/* ---------- Soporte ---------- */
.tickets { display: grid; gap: 0.8rem; }
.ticket { display: block; padding: 1.1rem 1.2rem; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.25s; }
.ticket:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--tint-300); }
.ticket__top { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.ticket__top .status { margin-left: auto; }
.ticket h3 { font-size: 1.05rem; margin: 0.45rem 0 0.25rem; }
.ticket p { margin: 0; font-size: 0.92rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.18rem 0.6rem; border-radius: 999px; background: var(--sky-50); box-shadow: inset 0 0 0 1px var(--line); font-size: 0.76rem; font-weight: 700; color: var(--text); }

.back { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--font-head); font-weight: 700; font-size: 0.9rem; color: var(--blue-600); }
.thread { display: grid; gap: 0.9rem; }
.msg { max-width: 84%; padding: 0.85rem 1.1rem; border-radius: 18px 18px 18px 6px; background: var(--sky-50); border: 1px solid var(--line); color: var(--text); }
.msg__meta { display: block; margin-bottom: 0.25rem; font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--me { margin-left: auto; border-radius: 18px 18px 6px 18px; background: var(--primary); border-color: transparent; color: #fff; }
.msg--me .msg__meta { color: rgba(255, 255, 255, 0.85); }
.msg--system { max-width: 100%; justify-self: center; padding: 0.3rem 0.9rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.reply { display: grid; gap: 0.7rem; margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.reply__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }

/* ---------- Visitas ---------- */
.visit { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.visit:first-child { padding-top: 0; }
.visit:last-child { border-bottom: 0; padding-bottom: 0; }
.visit__date { flex: none; width: 66px; padding: 0.55rem 0; border-radius: 16px; background: var(--sky-100); text-align: center; font-family: var(--font-head); color: var(--ink); line-height: 1.1; }
.visit__date small { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue-600); }
.visit__date strong { font-size: 1.6rem; font-weight: 900; font-style: italic; }
.visit__body { flex: 1; min-width: 12rem; }
.visit__body strong { display: block; font-family: var(--font-head); color: var(--ink); }
.visit__body span { display: block; font-size: 0.9rem; color: var(--muted); }
.visit__body span span { display: inline; }
.visit__actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 0.5rem; }
.picks--slots { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pick { position: relative; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pick span { display: block; padding: 0.6rem 0.4rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); text-align: center; font-weight: 700; font-size: 0.9rem; color: var(--ink); line-height: 1.25; transition: border-color 0.2s, background-color 0.2s; }
.pick small { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.pick input:hover + span { border-color: var(--tint-300); }
.pick input:checked + span { border-color: var(--primary); background: var(--sky-100); }
.pick input:focus-visible + span { outline: 3px solid var(--blue-400); outline-offset: 2px; }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 0.5rem; min-width: 0; }
.fieldset legend { padding: 0; margin-bottom: 0.5rem; font-family: var(--font-head); font-weight: 700; font-size: 0.88rem; color: var(--ink); }

/* ---------- Mi servicio: test de velocidad (widget de OpenSpeedTest) ---------- */
/* Fondo blanco fijo: el widget es de otro dominio y no sigue el modo oscuro. */
.ost { position: relative; height: 380px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: #fff; }
.ost__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ost__credit { margin: 0.7rem 0 0; text-align: right; font-size: 0.82rem; color: var(--muted); }
.ost__credit a { font-weight: 700; color: var(--blue-600); }
.health { display: flex; align-items: center; gap: 1rem; }
.health__icon { flex: none; width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; font-size: 2rem; background: var(--ok-bg); color: var(--ok); }
.health h2 { font-size: 1.4rem; margin: 0 0 0.15rem; }
.health p { margin: 0; color: var(--muted); }

/* ---------- Perfil ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.form-grid .field--full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.field input[readonly] { color: var(--muted); cursor: default; }
.hint { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 0.85rem; color: var(--muted); }
.hint i { font-size: 1.1rem; color: var(--blue-600); flex: none; }
.pref { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.pref:first-child { padding-top: 0; }
.pref:last-child { border-bottom: 0; padding-bottom: 0; }
.pref__body { flex: 1; }
.pref__body strong { display: block; font-family: var(--font-head); font-size: 0.95rem; color: var(--ink); }
.pref__body span { font-size: 0.88rem; color: var(--muted); }
.switch { position: relative; flex: none; width: 48px; height: 28px; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--tint-300); transition: background-color 0.25s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.3s var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--blue-400); outline-offset: 2px; }
.profile-id { display: flex; align-items: center; gap: 1rem; }
.profile-id .avatar { width: 64px; height: 64px; font-size: 1.3rem; }
.profile-id h2 { font-size: 1.4rem; margin: 0 0 0.1rem; }
.profile-id p { margin: 0; color: var(--muted); }

/* ---------- Diálogos ---------- */
.modal { padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text); width: min(540px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal--wide { width: min(700px, calc(100vw - 2rem)); }
.modal::backdrop { background: rgba(7, 20, 46, 0.58); backdrop-filter: blur(3px); }
.modal[open] { display: flex; flex-direction: column; animation: modal-in 0.35s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.modal__form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.4rem 1rem; }
.modal__head h2 { margin: 0; font-size: 1.3rem; }
.modal__head p { margin: 0.2rem 0 0; font-size: 0.92rem; color: var(--muted); }
.modal__close { width: 38px; height: 38px; font-size: 1.1rem; }
/* max-content: cada fila mide lo que su contenido (p. ej. el formulario de tarjeta de PayPal,
   que crece al desplegarse) y el cuerpo hace scroll, en vez de comprimir filas. */
.modal__body { display: grid; grid-auto-rows: max-content; gap: 1rem; padding: 0 1.4rem 1.3rem; overflow-y: auto; }
.modal__body > p { margin: 0; }
.modal__foot { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; padding: 1rem 1.4rem; border-top: 1px solid var(--line); background: var(--sky-50); }
.summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem; border-radius: var(--r-sm); background: var(--sky-50); border: 1px solid var(--line); }
.summary span { font-size: 0.92rem; color: var(--muted); }
.summary strong { font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; color: var(--ink); }
.summary .summary__small { font-size: 1rem; }
.summary__amount { text-align: right; line-height: 1.2; }
.summary__amount small { display: block; margin-top: 0.2rem; font-size: 0.82rem; font-weight: 600; color: var(--muted); }

/* Botones de PayPal: fondo blanco fijo porque el formulario de tarjeta de PayPal
   (iframe de otro dominio) no sigue el modo oscuro. */
.pp-box { position: relative; padding: 1rem; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; }
.pp-status { margin: 0; display: flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 88px; font-weight: 600; font-size: 0.92rem; color: #5f6b85; }
.pp-status i { font-size: 1.2rem; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal__foot--center { justify-content: center; border-top: 0; background: none; padding-top: 0.4rem; }
.doc__status { margin-top: 0.5rem; }
.swap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.8rem; text-align: center; }
.swap > div { padding: 0.9rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg); }
.swap small { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.swap strong { display: block; font-family: var(--font-head); font-weight: 900; font-style: italic; font-size: 1.8rem; color: var(--ink); line-height: 1.1; }
.swap span { font-size: 0.85rem; color: var(--muted); }
.swap > i { font-size: 1.4rem; color: var(--blue-600); }
.upload { position: relative; display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1rem; border-radius: var(--r-sm); border: 1.5px dashed var(--tint-300); background: var(--bg); cursor: pointer; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload i { font-size: 1.6rem; color: var(--blue-600); flex: none; }
.upload strong { display: block; font-family: var(--font-head); font-size: 0.9rem; color: var(--ink); overflow-wrap: anywhere; }
.upload span { font-size: 0.82rem; color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.92rem; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 0.15rem; accent-color: var(--primary); flex: none; }
.done { text-align: center; padding: 1.8rem 1.4rem 0.6rem; }
.done__icon { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center; font-size: 2.4rem; background: var(--ok-bg); color: var(--ok); }
.done h2 { font-size: 1.4rem; margin-bottom: 0.3rem; }
.done p { margin: 0; color: var(--muted); }

.doc-page { max-width: 820px; padding: clamp(1.35rem, 3vw, 2.2rem); }
.doc { display: grid; gap: 1.1rem; }
.doc__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.doc__head img { height: 30px; width: auto; }
.doc__head p { margin: 0.5rem 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
.doc__num { text-align: right; }
.doc__num strong { display: block; font-family: var(--font-head); font-size: 1.1rem; color: var(--ink); }
.doc__num small { font-size: 0.82rem; color: var(--muted); }
.doc__lines { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.doc__lines th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.doc__lines td { padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.doc__lines td:last-child, .doc__lines th:last-child { text-align: right; }
.doc__lines tfoot td { border-bottom: 0; font-family: var(--font-head); font-weight: 800; color: var(--ink); font-size: 1.1rem; }

/* ---------- Notificaciones y toasts ---------- */
.notif { position: fixed; z-index: 130; top: calc(var(--top-h) + 0.5rem); right: clamp(1rem, 3vw, 2rem); width: min(390px, calc(100vw - 2rem)); max-height: min(72vh, 540px); overflow-y: auto; display: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); }
.notif.is-open { display: block; animation: modal-in 0.3s var(--ease); }
.notif__head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.notif__head h2 { margin: 0; font-size: 1.05rem; }
.notif__head button { border: 0; background: none; padding: 0; font-weight: 700; font-size: 0.82rem; color: var(--blue-600); cursor: pointer; }
.notif .list { padding: 1rem 1.2rem; }

.toasts { position: fixed; z-index: 300; right: 1rem; bottom: 1rem; display: grid; gap: 0.6rem; justify-items: end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 0.6rem; max-width: min(420px, calc(100vw - 2rem)); padding: 0.8rem 1.1rem; border-radius: 14px; background: var(--navy-950); border: 1px solid rgba(255, 255, 255, 0.14); color: #fff; font-weight: 600; font-size: 0.92rem; box-shadow: var(--shadow-md); animation: toast-in 0.4s var(--ease); }
.toast i { font-size: 1.3rem; color: #3ce28a; flex: none; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.3s, transform 0.3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } }

.tabbar { display: none; }

/* ---------- Acceso ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth__aside { position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 2.5rem; padding: clamp(2rem, 5vw, 4rem); background: linear-gradient(150deg, var(--navy-800), var(--navy-950)); color: var(--sky-200); }
.auth__bg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; opacity: 0.22; }
.auth__aside .arcs { color: rgba(255, 255, 255, 0.08); width: 420px; right: -90px; top: -110px; }
.auth__aside > a img { height: 40px; width: auto; }
.auth__aside h1 { color: #fff; font-size: clamp(2rem, 4vw, 3.2rem); margin-bottom: 0.4em; }
.auth__aside h1 .heavy { color: var(--blue-400); }
.auth__aside p { font-size: 1.1rem; max-width: 30rem; margin: 0; }
.auth__list { display: grid; gap: 0.9rem; }
.auth__list li { display: flex; align-items: center; gap: 0.8rem; font-weight: 600; color: #fff; }
.auth__list i { flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.3rem; background: rgba(255, 255, 255, 0.1); color: var(--sky-300); }
.auth__main { display: flex; flex-direction: column; padding: clamp(1.2rem, 3vw, 2rem) clamp(1.2rem, 4vw, 3rem); }
.auth__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.auth__logo { display: none; }
.auth__card { width: min(100%, 420px); margin: auto; padding-block: 2rem; }
.auth__card h2 { font-size: clamp(1.7rem, 3vw, 2.1rem); margin-bottom: 0.3rem; }
.auth__card > p { color: var(--muted); margin-bottom: 1.6rem; }
.auth__form { display: grid; gap: 1rem; }
.auth__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; }
.auth__row a { font-weight: 700; color: var(--blue-600); }
.pass { position: relative; }
.pass input { padding-right: 3rem; }
.pass button { position: absolute; right: 0.4rem; top: 50%; translate: 0 -50%; width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.2rem; display: grid; place-items: center; cursor: pointer; }
.pass button:hover { color: var(--ink); background: var(--sky-100); }
.auth__divider { display: flex; align-items: center; gap: 0.8rem; margin: 1.3rem 0; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.auth__divider::before, .auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth__foot { margin-top: 1.6rem; font-size: 0.92rem; color: var(--muted); text-align: center; }
.auth__foot a { font-weight: 700; color: var(--blue-600); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); transform: translateX(-105%); visibility: hidden; transition: transform 0.45s var(--ease), visibility 0.45s; box-shadow: 30px 0 60px -30px rgba(7, 20, 46, 0.6); }
  .side.is-open { transform: none; visibility: visible; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 105; background: rgba(7, 20, 46, 0.5); opacity: 0; visibility: hidden; transition: opacity 0.35s, visibility 0.35s; }
  .side-backdrop.is-open { opacity: 1; visibility: visible; }
  .top__menu { display: grid; }
}

@media (max-width: 900px) {
  .grid--main, .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__aside { display: none; }
  .auth__logo { display: block; }
  .auth__logo img { height: 30px; width: auto; }
}

@media (max-width: 820px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .table tbody tr:first-child { padding-top: 0; }
  .table td { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.22rem 0; border: 0; text-align: right; }
  .table td::before { content: attr(data-label); font-size: 0.8rem; font-weight: 600; color: var(--muted); text-align: left; }
  .table td.table__main { display: block; text-align: left; padding-bottom: 0.4rem; }
  .table td.table__main::before { display: none; }
  .table td.table__actions { justify-content: flex-start; padding-top: 0.6rem; }
  .table td.table__actions::before { display: none; }
}

@media (max-width: 720px) {
  :root { --top-h: 64px; }
  .grid--3, .plan-opts, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .view { padding-bottom: 6rem; }
  .service-pill, .user-chip > div { display: none; }
  .user-chip { padding: 0.25rem; }
  .top { gap: 0.6rem; }
  .top__title h1 { font-size: 1.15rem; }
  .top__title p { display: none; }
  .top__actions { gap: 0.5rem; }
  .theme-switch__track { width: 58px; }
  :root[data-theme="dark"] .theme-switch__thumb { transform: translateX(24px); }
  .cycle { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1rem; }
  .due__actions .btn { flex: 1 1 100%; }
  .msg { max-width: 94%; }
  .modal__foot .btn { flex: 1 1 auto; }
  .manage { flex-wrap: wrap; }
  .toasts { right: 0.75rem; left: 0.75rem; bottom: 5.4rem; justify-items: stretch; }
  .notif { right: 0.75rem; left: 0.75rem; width: auto; }

  .tabbar { position: fixed; inset: auto 0 0 0; z-index: 100; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0.35rem 0.3rem calc(0.35rem + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -20px rgba(7, 20, 46, 0.5); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 0.1rem; padding: 0.4rem 0; border: 0; border-radius: 12px; background: none; font-family: var(--font-body); font-size: 0.68rem; font-weight: 700; color: var(--muted); cursor: pointer; }
  .tabbar i { font-size: 1.4rem; }
  .tabbar .is-active { color: var(--blue-600); }
}

/* Impresión de la factura (oficina/factura.html): solo el documento */
@media print {
  /* Siempre en claro sobre papel, aunque el panel esté en modo oscuro. */
  :root, :root[data-theme="dark"] {
    --surface: #fff; --bg: #fff; --ink: #0d2853; --text: #43506b; --muted: #5f6b85; --line: #dce4f2; --sky-50: #f1f5fd;
    --ok-bg: #dcf8e7; --ok-ink: #0b5c31; --amber-bg: #fff3d6; --amber-ink: #8a5a00; --violet-bg: #efe8ff; --violet-ink: #5b3db5;
  }
  :root[data-theme="dark"] .brand__logo--light { display: block; }
  :root[data-theme="dark"] .brand__logo--dark { display: none; }
  .side, .side-backdrop, .top, .tabbar, .notif, .toasts, .skip-link, .no-print { display: none !important; }
  .app { display: block; }
  .view { max-width: none; padding: 0; }
  .view > * { animation: none; }
  .doc-page { max-width: none; border: 0; padding: 0; }
}

/* ---------- Envío por AJAX (http.js) ---------- */
/* Aviso de error: icono en tono de error, como en el panel administrativo. */
.toast--bad i { color: #ff8a73; }
/* Los avisos se muestran como popover manual para quedar por encima de los diálogos abiertos. */
.toasts[popover] { inset: auto 1rem 1rem auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; color: inherit; }
/* Botón ocupado mientras el servidor responde. */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; transform: none; --spin: #fff; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--spin); border-right-color: transparent; border-bottom-color: transparent; animation: spin 0.7s linear infinite; }
.btn--ghost.is-loading { --spin: var(--blue-600); }
.btn--wa.is-loading { --spin: var(--green-wa-ink); }
.btn--light.is-loading { --spin: var(--navy-900); }
/* Acciones [data-action] que no son botones .btn (p. ej. «Marcar todas como leídas»). */
[data-action].is-loading:not(.btn) { opacity: 0.6; pointer-events: none; cursor: progress; }
/* Confirmación de una acción delicada (dlgConfirm con data-tone="bad"). */
#dlgConfirm[data-tone="bad"] [data-confirm-ok] { background: var(--warn); border-color: var(--warn); color: #fff; box-shadow: none; }
@media (max-width: 720px) {
  .toasts[popover] { inset: auto 0.75rem 5.4rem 0.75rem; }
}

/* ---------- Layout de la oficina ---------- */
/* Píldora del servicio según el estado del cliente (el tono «ok» es el de arriba). */
.service-pill--info { background: var(--info-bg); color: var(--info-ink); }
.service-pill--info .status-dot { background: var(--info-ink); }
.service-pill--warn { background: var(--amber-bg); color: var(--amber-ink); }
.service-pill--warn .status-dot { background: var(--amber-ink); }
.service-pill--hold { background: var(--violet-bg); color: var(--violet-ink); }
.service-pill--hold .status-dot { background: var(--violet-ink); }
.service-pill--bad { background: var(--bad-bg); color: var(--bad-ink); }
.service-pill--bad .status-dot { background: var(--warn); }
.service-pill--muted { background: var(--sky-50); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.service-pill--muted .status-dot { background: var(--muted); }
/* «Cerrar sesión» de la barra lateral es un formulario enviado por AJAX. */
button.side__logout { width: 100%; border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer; }
/* Enlace del menú cuyo módulo aún no existe. */
.side__link[href="#"] { opacity: 0.55; }
