/* ==========================================================================
   Mis servicios (ms-*): acceso del cliente y tarjetas de sus membresías.
   Se carga después de cliente.css (portal) en cliente.php y mis-servicios.php.
   ========================================================================== */

/* Enlace desde el portal */
.ms-entry { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 13px 14px; border: 1px solid #e3e7ee; border-radius: 14px; background: linear-gradient(180deg, #fff, #f7f9fc); color: var(--ink); text-align: left; text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.ms-entry:hover { border-color: #c9d0dc; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(20, 33, 58, .08); }
.ms-entry:focus-visible { outline: 3px solid rgba(20, 33, 58, .35); outline-offset: 2px; }
.ms-entry-icon { display: grid; flex: none; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #14213a; color: #fff; }
.ms-entry strong { display: block; font-size: 14px; }
.ms-entry small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.ms-entry-arrow { margin-left: auto; color: #98a2b3; font-size: 18px; transition: transform .15s, color .15s; }
.ms-entry:hover .ms-entry-arrow { transform: translateX(3px); color: var(--coral); }
.client-new-row { display: flex; gap: 10px; }
.client-new-row .client-new { flex: 1; }

/* Estados (el portal no carga los estilos del panel) */
.ms-page .state-pill { --s: #1f8a5b; display: inline-flex; flex: none; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border: 1px solid color-mix(in srgb, var(--s) 24%, #fff); border-radius: 999px; background: color-mix(in srgb, var(--s) 9%, #fff); color: var(--s); font-size: 10.5px; font-weight: 800; letter-spacing: .7px; white-space: nowrap; }
.ms-page .state-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--s)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--s)) 20%, transparent); }
.ms-page .state-activos { --s: #1f8a5b; }
.ms-page .state-por_vencer { --s: #a87800; --dot: #f2b705; }
.ms-page .state-vencidos { --s: #c0392b; }
.ms-page .state-suspendidos { --s: #1b2433; --dot: #8a94a6; }

/* ---------- Acceso ---------- */
.ms-login form { gap: 16px; }
.ms-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 13px; background: #eef1f6; }
.ms-seg label { position: relative; }
.ms-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ms-seg span { display: block; padding: 9px 8px; border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.ms-seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(20, 33, 58, .12); }
.ms-seg input:focus-visible + span { outline: 3px solid rgba(20, 33, 58, .35); outline-offset: 1px; }
.ms-login .field input { width: 100%; padding: 14px 15px; border: 1.5px solid #d5dae3; border-radius: 12px; background: #fff; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.ms-login .field input:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 4px rgba(233, 87, 63, .15); }
.ms-help { color: #8a94a6; font-size: 12px; line-height: 1.45; }
.ms-secret { position: relative; }
.ms-login .ms-secret input { padding-right: 48px; }
.ms-eye { position: absolute; top: 50%; right: 8px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: #8a94a6; transform: translateY(-50%); cursor: pointer; }
.ms-eye:hover, .ms-eye.is-on { background: #f1f3f7; color: var(--ink); }
.ms-back { display: inline-block; margin-top: 18px; color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.ms-back:hover { color: var(--coral); }

/* ---------- Panel del cliente ---------- */
body.ms-page.is-dashboard { justify-content: flex-start; padding-top: 28px; padding-bottom: 28px; }
.ms-shell { width: min(980px, 100%); animation: card-in .45s cubic-bezier(.2, .7, .2, 1) both; }
.ms-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ms-top .brand { color: #fff; font-size: 18px; }
.ms-logout { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 11px; background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: background .15s; }
.ms-logout:hover { background: rgba(255, 255, 255, .16); }
.ms-logout:focus-visible { outline: 3px solid rgba(255, 255, 255, .45); outline-offset: 2px; }

.ms-hello { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 24px; border-radius: 22px; background: var(--paper, #fffefa); box-shadow: 0 30px 70px rgba(0, 0, 0, .28); }
.ms-kicker { display: inline-block; margin-bottom: 8px; padding: 4px 11px; border-radius: 999px; background: #fdece8; color: #d04a34; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.ms-hello h1 { margin: 0 0 6px; font: 700 28px/1.15 'Space Grotesk', sans-serif; letter-spacing: -.5px; }
.ms-hello p { margin: 0; color: var(--muted); font-size: 14.5px; }
.ms-hello p strong { color: var(--ink); }
.ms-summary { display: flex; flex-wrap: wrap; gap: 10px; }
.ms-sum { display: flex; flex-direction: column; justify-content: center; min-width: 96px; padding: 12px 14px; border-radius: 14px; background: #f3f5f8; }
.ms-sum strong { font: 700 26px/1.05 'Space Grotesk', sans-serif; }
.ms-sum span { color: var(--muted); font-size: 12px; font-weight: 600; }
.ms-sum.is-ok { background: #e6f5ed; }
.ms-sum.is-ok strong { color: #17694a; }
.ms-sum.is-warn { background: #fff4dc; }
.ms-sum.is-warn strong { color: #9a5b00; }
.ms-sum.is-next { min-width: 190px; background: #14213a; color: #fff; }
.ms-sum.is-next span { color: rgba(255, 255, 255, .65); }
.ms-sum.is-next strong { margin: 2px 0; font-size: 17px; line-height: 1.25; }
.ms-sum.is-next small { color: rgba(255, 255, 255, .75); font-size: 12px; }

.ms-notice { margin: 0 0 16px; border-radius: 14px; }
.ms-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ms-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s; }
.ms-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--s)); }
.ms-chip.state-suspendidos i { background: #a3adbb; }
.ms-chip b { padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: 11.5px; }
.ms-chip:hover { background: rgba(255, 255, 255, .16); }
.ms-chip[aria-pressed="true"] { border-color: #fff; background: #fff; color: #14213a; }
.ms-chip[aria-pressed="true"] b { background: #eef1f6; }
.ms-chip:focus-visible { outline: 3px solid rgba(255, 255, 255, .45); outline-offset: 2px; }

.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.ms-card { --c: #667085; --st: #1f8a5b; position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; overflow: hidden; border-radius: 20px; background: var(--paper, #fffefa); box-shadow: 0 18px 40px rgba(0, 0, 0, .22); animation: card-in .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: var(--delay, 0ms); transition: transform .2s, box-shadow .2s; }
.ms-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); }
.ms-card:hover { transform: translateY(-3px); box-shadow: 0 24px 50px rgba(0, 0, 0, .28); }
.ms-card[hidden] { display: none; }
.ms-card.is-por_vencer { --st: #c47a10; }
.ms-card.is-vencidos { --st: #c0392b; }
.ms-card.is-suspendidos { --st: #5b6475; }
.ms-card.is-focus { animation: ms-focus 1.2s ease 2; }
@keyframes ms-focus { 50% { box-shadow: 0 0 0 4px var(--coral), 0 24px 50px rgba(0, 0, 0, .28); } }

.ms-card-head { display: flex; align-items: center; gap: 12px; }
.ms-logo { display: grid; flex: none; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 13px; background: var(--c); color: #fff; font: 700 19px 'Space Grotesk', sans-serif; font-style: normal; box-shadow: 0 6px 14px rgba(20, 33, 58, .18); }
.ms-logo.has-img { background: transparent; box-shadow: none; }
.ms-logo img { width: 100%; height: 100%; object-fit: contain; }
.ms-title { flex: 1; min-width: 0; }
.ms-title strong { display: block; overflow: hidden; font-size: 16px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.ms-title small { color: var(--muted); font-size: 12.5px; }

.ms-card-body { display: flex; align-items: center; gap: 16px; }
.ms-ring { position: relative; flex: none; width: 88px; height: 88px; }
.ms-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ms-ring circle { fill: none; stroke-width: 6; }
.ms-ring-bg { stroke: color-mix(in srgb, var(--st) 14%, #fff); }
.ms-ring-fg { stroke: var(--st); stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p)); stroke-linecap: round; animation: ms-ring 1s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--delay, 0ms) + 150ms); }
@keyframes ms-ring { from { stroke-dashoffset: 100; } }
.ms-ring > span { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--st); }
.ms-ring b { font: 700 26px/1 'Space Grotesk', sans-serif; letter-spacing: -.5px; }
.ms-ring b.is-text { font-size: 19px; }
.ms-ring small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }

.ms-facts { display: grid; flex: 1; min-width: 0; gap: 7px; margin: 0; }
.ms-facts div, .ms-more dl div { display: grid; gap: 1px; min-width: 0; }
.ms-facts dt, .ms-more dt { color: #8a94a6; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.ms-facts dd, .ms-more dd { min-width: 0; margin: 0; color: var(--ink); font-size: 14px; font-weight: 600; }
.ms-facts em { display: block; color: var(--st); font-size: 12px; font-style: normal; font-weight: 700; }
.ms-email { display: flex; align-items: center; gap: 4px; }
.ms-email span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ms-copy { display: grid; flex: none; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: #f1f3f7; color: #5b6475; cursor: pointer; transition: background .15s, color .15s; }
.ms-copy:hover { background: #e6e9ef; color: var(--ink); }
.ms-copy.is-done { background: #e0f4e9; color: #17694a; }

.ms-more { border-top: 1px dashed #e3e7ee; padding-top: 10px; }
.ms-more summary { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; list-style: none; cursor: pointer; }
.ms-more summary::-webkit-details-marker { display: none; }
.ms-more summary::after { content: ''; width: 7px; height: 7px; margin-left: 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
.ms-more[open] summary::after { transform: rotate(225deg) translateY(-1px); }
.ms-more summary:hover { color: var(--ink); }
.ms-more dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 12px 0 0; animation: card-in .25s ease both; }

.ms-2fa, .ms-locked { display: flex; align-items: center; gap: 7px; margin: 0; padding: 8px 11px; border-radius: 10px; font-size: 12.5px; font-weight: 600; }
.ms-2fa { background: #e8f6ee; color: #17694a; }
.ms-locked { background: #fbe4e2; color: #a33f2c; }
.ms-2fa svg, .ms-locked svg { flex: none; }

.ms-actions { display: flex; gap: 8px; margin-top: auto; }
.ms-actions form { display: flex; flex: 1; }
.ms-btn { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.ms-btn:focus-visible { outline: 3px solid rgba(20, 33, 58, .35); outline-offset: 2px; }
.ms-btn { white-space: nowrap; }
/* Junto a "Pedir código", Renovar ocupa solo lo necesario (el principal manda). */
.ms-actions form + .ms-btn { flex: 0 0 auto; }
.ms-btn-primary { background: linear-gradient(135deg, #f0654b, #e04a31); color: #fff; box-shadow: 0 8px 18px rgba(233, 87, 63, .3); }
.ms-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(233, 87, 63, .36); }
.ms-btn-primary.is-busy { opacity: .75; cursor: progress; }
.ms-btn-ghost { flex: 0 0 auto; background: #f1f3f7; color: var(--ink); }
.ms-btn-ghost:hover { background: #e6e9ef; }
.ms-btn-wa { background: #1faa59; color: #fff; box-shadow: 0 8px 18px rgba(31, 170, 89, .28); }
.ms-btn-wa:hover { background: #198f4a; transform: translateY(-1px); }

.ms-none { margin: 10px 0 0; padding: 26px; border-radius: 18px; background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .8); text-align: center; }
.ms-none[hidden] { display: none; }
.ms-foot { margin-top: 22px; }

@media (max-width: 640px) {
    .ms-hello { padding: 20px 18px; border-radius: 18px; }
    .ms-hello h1 { font-size: 24px; }
    .ms-summary { width: 100%; }
    .ms-sum { flex: 1; min-width: 0; }
    .ms-sum.is-next { flex-basis: 100%; }
    .ms-grid { grid-template-columns: 1fr; }
    .ms-ring { width: 76px; height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
    .ms-card, .ms-ring-fg, .ms-shell, .ms-more dl, .ms-card.is-focus { animation: none; }
    .ms-card:hover, .ms-entry:hover, .ms-btn:hover { transform: none; }
}

/* Comprobante de pago (ms-pay, ms-receipt) */
.ms-receipt-state { display: flex; align-items: flex-start; gap: 7px; margin: 0; padding: 8px 11px; border-radius: 10px; font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.ms-receipt-state svg { flex: none; margin-top: 1px; }
.ms-receipt-state.is-pending { background: #fff4dc; color: #8a6400; }
.ms-receipt-state.is-ok { background: #e3f5ec; color: #17694a; }
.ms-receipt-state.is-bad { background: #fbe4e2; color: #a33f2c; }
.ms-pay { border-top: 1px dashed #e3e7ee; padding-top: 10px; }
.ms-pay summary { display: flex; align-items: center; gap: 7px; color: #2a78d6; font-size: 13px; font-weight: 700; list-style: none; cursor: pointer; }
.ms-pay summary::-webkit-details-marker { display: none; }
.ms-pay summary:hover { color: #1f5fa8; }
.ms-pay[open] summary { color: var(--ink); }
.ms-receipt { display: grid; gap: 8px; margin-top: 10px; }
.ms-file { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 12px; border: 2px dashed #c9d0dc; border-radius: 12px; background: #f7f9fc; color: #4a5568; font-size: 13.5px; font-weight: 700; text-align: center; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.ms-file:hover, .ms-file:focus-within { border-color: #2a78d6; background: #eef5fd; color: #1f5fa8; }
.ms-file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ms-file span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-receipt.has-file .ms-file { border-style: solid; border-color: #1f8a5b; background: #e3f5ec; color: #17694a; }
.ms-note { width: 100%; padding: 10px 12px; border: 1px solid #d5dae3; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 13.5px; }
.ms-note:focus { outline: none; border-color: #2a78d6; box-shadow: 0 0 0 3px rgba(42, 120, 214, .15); }
.ms-receipt .ms-btn { justify-content: center; }
.ms-receipt .ms-btn[disabled] { opacity: .6; cursor: wait; }
.ms-receipt small { color: var(--muted); font-size: 11.5px; text-align: center; }
.ms-ok { background: #e3f5ec; border-color: #bfe6d1; color: #17694a; }

/* ---------- Cualquier pantalla ---------- */
/* Las tarjetas ocupan el ancho disponible (sin desbordar en 320 px); un solo servicio queda centrado y más ancho. */
.ms-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.ms-grid:has(> .ms-card:only-child) { grid-template-columns: minmax(0, 560px); justify-content: center; }
@media (max-width: 360px) {
    .ms-top .brand { font-size: 15px; }
    .ms-hello h1 { font-size: 22px; }
}
