/* Área de cliente: registro, login, recuperar, reservar, cuenta + botón de acceso en el header.
   Cores/escala de tokens.css. Superfície clara (stone-2) sobre stone, hero night igual às demais páginas. */

/* ---------- Hero compacto (sem arte) ---------- */
.cl .cl-hero { padding: clamp(6rem, 11vw, 8.5rem) 0 clamp(2rem, 4vw, 3.25rem); }
.cl .cl-hero .page-hero__grid { grid-template-columns: minmax(0, 1fr); }
.cl .cl-hero .page-hero__copy { max-width: 40rem; }
.cl .cl-main-section { padding-top: clamp(1.5rem, 3vw, 2.5rem); }
.cl-narrow { width: min(100%, 32rem); margin-inline: auto; }
.cl-wide { width: min(100%, 60rem); margin-inline: auto; }

/* ---------- Cartão / formulário ---------- */
.cl-card {
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: var(--radius-lg);
    background: var(--stone-2);
    color: var(--ink);
    box-shadow: var(--shadow-card);
}
.cl-card + .cl-card { margin-top: var(--space-6); }
.cl-card h2, .cl-card h3 { color: var(--ink); letter-spacing: -.02em; line-height: 1.2; }
.cl-card h2 { font-size: var(--fs-h3); margin-bottom: var(--space-4); }
.cl-card h3 { font-size: 1.125rem; margin-bottom: var(--space-2); }
.cl-card p { color: var(--ink-muted); }
.cl-form { display: grid; gap: var(--space-6); }
.cl-field { display: grid; gap: .375rem; }
.cl-label { font-weight: 650; color: var(--ink); font-size: var(--fs-small); }
.cl-hint { color: var(--ink-muted); font-size: var(--fs-caption); }
.cl-input {
    width: 100%; min-height: 48px; padding: .625rem .875rem;
    border: 1px solid rgb(22 19 14 / .38); border-radius: var(--radius-md);
    background: #fff; color: var(--ink); font: inherit;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.cl-input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-color: var(--ink); }
.cl-input[aria-invalid="true"] { border-color: #b3261e; box-shadow: 0 0 0 1px #b3261e; }
.cl-pw { position: relative; display: block; }
.cl-pw .cl-input { padding-right: 5.5rem; }
.cl-pw__toggle {
    position: absolute; top: 50%; right: .25rem; transform: translateY(-50%);
    min-width: 44px; min-height: 44px; padding: 0 .75rem; border: 0; border-radius: var(--radius-md);
    background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-small); font-weight: 650; cursor: pointer;
    text-decoration: underline; text-underline-offset: 3px;
}
.cl-pw__toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: 0; }
.cl-error { color: #b3261e; font-size: var(--fs-small); font-weight: 600; }
.cl-error[hidden], .cl-alert[hidden], .cl-ok[hidden] { display: none; }
.cl-alert, .cl-ok {
    padding: .875rem 1rem; border-radius: var(--radius-md); font-weight: 600; font-size: var(--fs-small);
}
.cl-alert { border: 1px solid #b3261e; background: #fdecea; color: #7f1710; }
.cl-ok { border: 1px solid #1b6b3a; background: #e8f5ec; color: #0f4a26; }
/* Alvo de toque 44px (DESIGN.md: "Todo link, botão de menu e CTA mede pelo menos 44x44px").
   A caixa visual do checkbox continua 1.5rem; o elemento é 2.75rem e o desenho vem dos pseudos. */
.cl-check { display: grid; grid-template-columns: 2.75rem 1fr; gap: .25rem; align-items: start; margin-inline-start: -.625rem; }
.cl-check input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    position: relative; flex: none; width: 2.75rem; height: 2.75rem;
    margin: -.625rem 0 0; padding: 0; border: 0; background: none; cursor: pointer;
}
.cl-check input[type="checkbox"]::before {
    content: ""; position: absolute; top: 50%; left: 50%; translate: -50% -50%;
    width: 1.5rem; height: 1.5rem;
    border: 2px solid var(--ink); border-radius: var(--radius-sm); background: #fff;
}
.cl-check input[type="checkbox"]:checked::before { background: var(--primary); }
.cl-check input[type="checkbox"]:checked::after {
    content: ""; position: absolute; top: 50%; left: 50%; translate: -50% -62%; rotate: 45deg;
    width: .4375rem; height: .8125rem;
    border: solid var(--text-dark); border-width: 0 .1875rem .1875rem 0;
}
.cl-check input[type="checkbox"]:focus-visible { outline: none; }
.cl-check input[type="checkbox"]:focus-visible::before { outline: 3px solid var(--ink); outline-offset: 3px; }
.cl-check label { color: var(--ink); line-height: 1.45; padding-block: .625rem; }
.cl-link, .cl-card a:not(.btn) { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
/* inline-block + padding simétrico: a baseline do texto continua alinhada com a frase em volta,
   só a caixa clicável cresce até 44px. Serve tanto para link solto como para link dentro de frase. */
.cl-link, .cl-card a:not(.btn) {
    display: inline-block; min-width: 2.75rem; min-height: 2.75rem;
    padding: .6875rem .125rem; margin-inline: -.125rem; line-height: 1.375;
}
.cl-card a:not(.btn):focus-visible, .cl-link:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: var(--radius-sm); }
.cl-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.cl-actions .btn { flex: 0 0 auto; }
.cl-foot { margin-top: var(--space-6); color: var(--ink-muted); }
.cl .btn-primary:focus-visible, .cl .btn-dark:focus-visible, .cl .btn-ghost:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.cl .btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px rgb(22 19 14 / .45); }
.cl .btn-danger { background: transparent; color: #7f1710; box-shadow: inset 0 0 0 1.5px #b3261e; }
.cl .btn[aria-busy="true"] { cursor: progress; opacity: .7; pointer-events: none; }
.cl-block { display: block; width: 100%; }
.cl-loading { color: var(--ink-muted); }
.cl-loading::before {
    content: ""; display: inline-block; width: 1em; height: 1em; margin-right: .5em; vertical-align: -.15em;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: cl-spin .8s linear infinite;
}
@keyframes cl-spin { to { transform: rotate(360deg); } }

/* ---------- Reservar: passos ---------- */
.cl-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-6); padding: 0; list-style: none; }
.cl-steps li {
    display: flex; align-items: center; gap: .5rem; padding-top: .625rem; border-top: 3px solid rgb(22 19 14 / .18);
    color: var(--ink-muted); font-size: var(--fs-small); font-weight: 600;
}
.cl-steps li[aria-current="step"] { border-top-color: var(--primary); color: var(--ink); }
.cl-steps li.is-done { border-top-color: var(--ink); color: var(--ink); }
.cl-steps__n {
    display: inline-grid; place-items: center; flex: 0 0 1.5rem; width: 1.5rem; height: 1.5rem; border-radius: 50%;
    background: rgb(22 19 14 / .1); font-size: .75rem; font-weight: 700;
}
.cl-steps li[aria-current="step"] .cl-steps__n { background: var(--primary); color: var(--text-dark); }
.cl-steps li.is-done .cl-steps__n { background: var(--ink); color: var(--on-night); }

.cl-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.cl-unit {
    position: relative; display: grid; gap: .25rem; width: 100%; padding: 1rem 1.125rem; text-align: left;
    border: 1.5px solid rgb(22 19 14 / .22); border-radius: var(--radius-md); background: #fff; color: var(--ink); font: inherit; cursor: pointer;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.cl-unit__id { font-size: 1.25rem; font-weight: 750; letter-spacing: -.02em; }
.cl-unit__size { font-weight: 600; }
.cl-unit__zone { color: var(--ink-muted); font-size: var(--fs-small); }
.cl-unit__price { margin-top: .25rem; font-weight: 700; }
.cl-unit__price small { color: var(--ink-muted); font-weight: 500; }
.cl-unit__state {
    justify-self: start; margin-top: .375rem; padding: .125rem .625rem; border-radius: var(--radius-full);
    background: #e8f5ec; color: #0f4a26; font-size: var(--fs-caption); font-weight: 700;
}
.cl-unit:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.cl-unit[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--primary), 0 0 0 4px var(--ink); }
.cl-unit:disabled { cursor: not-allowed; background: rgb(255 255 255 / .55); color: var(--ink-muted); }
.cl-unit:disabled .cl-unit__id, .cl-unit:disabled .cl-unit__size { color: var(--ink-muted); }
.cl-unit:disabled .cl-unit__state { background: rgb(22 19 14 / .1); color: var(--ink-muted); }
@media (pointer: fine) { .cl-unit:not(:disabled):hover { border-color: var(--ink); transform: translateY(-2px); } }

.cl-radios { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin: 0; padding: 0; border: 0; }
.cl-radios legend { margin-bottom: .375rem; padding: 0; font-weight: 650; font-size: var(--fs-small); }
.cl-radios legend { grid-column: 1 / -1; }
.cl-radio { position: relative; }
.cl-radio input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.cl-radio span {
    display: grid; place-items: center; min-height: 48px; padding: 0 .5rem; border: 1.5px solid rgb(22 19 14 / .3);
    border-radius: var(--radius-md); background: #fff; font-weight: 650; text-align: center;
}
.cl-radio input:checked + span { border-color: var(--ink); background: var(--primary); color: var(--text-dark); box-shadow: 0 0 0 2px var(--ink); }
.cl-radio input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 3px; }

.cl-summary { display: grid; gap: .625rem; margin: 0 0 var(--space-6); }
.cl-summary > div { display: flex; justify-content: space-between; gap: var(--space-4); padding-bottom: .625rem; border-bottom: 1px solid var(--line-stone); }
.cl-summary dt { color: var(--ink-muted); }
.cl-summary dd { font-weight: 650; text-align: right; }
.cl-contract { max-height: 14rem; overflow: auto; margin: 0 0 var(--space-4); padding: 1rem 1.125rem; border: 1px solid var(--line-stone); border-radius: var(--radius-md); background: #fff; }
.cl-contract:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.cl-contract h3 { font-size: 1rem; }
.cl-contract ol { display: grid; gap: .5rem; padding-left: 1.25rem; color: var(--ink-muted); font-size: var(--fs-small); }
.cl-done__num { display: inline-block; margin: var(--space-2) 0 var(--space-6); padding: .375rem 1rem; border-radius: var(--radius-md); background: var(--ink); color: var(--primary); font-size: 1.25rem; font-weight: 750; letter-spacing: .04em; }
.cl-next { display: grid; gap: .5rem; margin: 0 0 var(--space-6); padding-left: 1.25rem; color: var(--ink-muted); }

/* ---------- Cuenta ---------- */
.cl-res-list { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.cl-res { display: grid; gap: var(--space-3); padding: 1rem 1.125rem; border: 1px solid var(--line-stone); border-radius: var(--radius-md); background: #fff; }
.cl-res__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.cl-res__title { font-size: 1.125rem; font-weight: 750; color: var(--ink); }
.cl-res__meta { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; color: var(--ink-muted); font-size: var(--fs-small); }
.cl-badge { padding: .125rem .75rem; border-radius: var(--radius-full); background: #fff3c4; color: #5c4400; font-size: var(--fs-caption); font-weight: 700; }
.cl-badge--ok { background: #e8f5ec; color: #0f4a26; }
.cl-badge--off { background: rgb(22 19 14 / .1); color: var(--ink-muted); }
.cl-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.cl-confirm p { margin: 0; color: var(--ink); font-weight: 600; font-size: var(--fs-small); }
.cl-contract-view { padding: 1rem; border: 1px solid var(--line-stone); border-radius: var(--radius-md); background: #fff; }
.cl-contract-view iframe { width: 100%; min-height: 24rem; border: 0; background: #fff; }
.cl-contract-view dl { display: grid; gap: .5rem; }
.cl-contract-view pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-small); }
.cl-data { display: grid; gap: .75rem; margin: 0 0 var(--space-6); }
.cl-data > div { display: grid; grid-template-columns: 8rem 1fr; gap: var(--space-3); }
.cl-data dt { color: var(--ink-muted); }
.cl-data dd { font-weight: 650; overflow-wrap: anywhere; }
.cl-empty { color: var(--ink-muted); }

/* ---------- Botón Reservar en trasteros ---------- */
.size-guide__reserve { margin-top: var(--space-4); }
.size-guide__reserve .btn { min-height: 44px; }

@media (max-width: 768px) {
    .cl-radios { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cl-steps li > span:last-child { display: none; }
    .cl-steps li[aria-current="step"] > span:last-child { display: inline; }
    .cl-steps { grid-template-columns: repeat(3, auto); justify-content: space-between; }
    .cl-steps li { flex: 1; }
    .cl-data > div { grid-template-columns: 1fr; gap: 0; }
    .cl-actions .btn { width: 100%; }
    .cl-summary > div { flex-direction: column; gap: .125rem; }
    .cl-summary dd { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
    .cl-unit, .cl-input, .cl-loading::before { transition: none; animation: none; }
}

/* K1 (docs/design/FX.md): microinterações só em CSS, presas aos estados que cliente-auth.js / cliente-reservar.js
   já escrevem (aria-invalid, aria-busy, .cl-ok visível). Erro continua em texto (aria-describedby); labels reais
   ficam acima do campo (sem label flutuante: exigiria trocar a ordem do markup). Movimento reduzido: nada anima. */
.cl .btn[aria-busy="true"]::before {
    content: ""; display: inline-block; width: 1em; height: 1em; margin-right: .5em; vertical-align: -.15em;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
}
/* Sucesso no botão: marca ✓ (texto, não só cor) + verde; data-state="ok" escrito por cliente-auth.js ao responder ok. */
.cl .btn[data-state="ok"] { background: #1b6b3a; border-color: #1b6b3a; color: #fff; }
.cl .btn[data-state="ok"]::before { content: "\2713"; margin-right: .5em; font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
    .cl .btn[data-state="ok"]::before { animation: cl-ok-in .32s var(--ease) both; }
    .cl-input[aria-invalid="true"], .cl-check input[aria-invalid="true"] { animation: cl-shake .18s linear; }
    .cl .btn[aria-busy="true"]::before { animation: cl-spin .8s linear infinite; }
    .cl-ok:not([hidden]) { animation: cl-ok-in .32s var(--ease) both; }
}
@keyframes cl-shake { 25% { transform: translateX(6px); } 75% { transform: translateX(-6px); } }
@keyframes cl-ok-in { from { opacity: 0; transform: translate3d(0, 6px, 0); } to { opacity: 1; transform: none; } }

.cl [id] { scroll-margin-top: 6rem; }

/* ---- Campos: e-mail/tel/select coerentes, autofill sem estragar o visual ---- */
.cl-input { color-scheme: light; font-size: 1rem; line-height: 1.4; text-overflow: ellipsis; }
.cl-input:-webkit-autofill, .cl-input:-webkit-autofill:hover, .cl-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink); caret-color: var(--ink); -webkit-box-shadow: 0 0 0 100px #fff inset; transition: background-color 9999s;
}
.cl-input::placeholder { color: #7a746a; opacity: 1; }
.cl-phone { display: grid; grid-template-columns: minmax(0, 8rem) minmax(0, 1fr); gap: .5rem; }
.cl-select {
    padding-right: 2rem; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
    background-position: calc(100% - 1.1rem) 52%, calc(100% - .8rem) 52%; background-size: .3rem .3rem; background-repeat: no-repeat;
}
@media (max-width: 480px) { .cl-phone { grid-template-columns: minmax(0, 7.25rem) minmax(0, 1fr); } }
.cl-select { -webkit-appearance: none; appearance: none; }
.cl-card .cl-error { color: #b3261e; font-weight: 600; }
.cl-card .cl-hint { color: var(--ink-muted); }

/* ---- Seletor de país/prefijo (bandeira SVG local) ---- */
.cl-cc { position: relative; }
.cl-flag { display: block; flex: 0 0 auto; width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgb(22 19 14 / .18); }
.cl-cc__btn { display: flex; align-items: center; gap: .5rem; width: 100%; padding-right: .75rem; text-align: left; cursor: pointer; }
.cl-cc__dial { font-weight: 650; color: var(--ink); white-space: nowrap; }
.cl-cc__caret { margin-left: auto; width: .5rem; height: .5rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-2px) rotate(45deg); }
.cl-cc__btn[aria-expanded="true"] .cl-cc__caret { transform: translateY(2px) rotate(-135deg); }
.cl-cc__list {
    position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: max(100%, 17rem); max-width: calc(100vw - 2.5rem); max-height: 16rem; overflow: auto;
    margin: 0; padding: .25rem; list-style: none; border: 1px solid rgb(22 19 14 / .3); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-card);
}
.cl-cc__list[hidden] { display: none; }
.cl-cc__list:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.cl-cc__list li { display: flex; align-items: center; gap: .625rem; min-height: 44px; padding: 0 .625rem; border-radius: var(--radius-sm); cursor: pointer; color: var(--ink); }
.cl-cc__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-cc__list li[aria-selected="true"] { font-weight: 700; background: #fff3c4; }
.cl-cc__list li.is-active { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (pointer: fine) { .cl-cc__list li:hover { background: rgb(22 19 14 / .07); } }

/* ---- Painel P0/P1: acesso, aviso de pagamento, baja, RGPD, ajuda, edição ---- */
.cl-res__access { display: grid; gap: .125rem; margin: 0; color: var(--ink); font-size: var(--fs-small); }
.cl-res__access .cl-hint { display: block; }
.cl-notice { margin: 0; padding: .75rem 1rem; border-left: 4px solid var(--primary); border-radius: var(--radius-sm); background: #fff8dc; color: var(--ink); font-size: var(--fs-small); font-weight: 600; }
.cl-confirm--col { display: grid; align-items: stretch; }
.cl-help__ids { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.cl-gdpr { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--line-stone); display: grid; gap: var(--space-3); }
.cl-gdpr h3, .cl-gdpr p { margin: 0; }
.cl-card .btn, .cl-res .btn { min-height: 44px; max-width: 100%; white-space: normal; }
.cl-input[type="date"] { min-height: 44px; max-width: 100%; }
.cl-ok:focus-visible, .cl-alert:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (max-width: 768px) { .cl-confirm .btn { width: 100%; } }

/* ---------- Facturas y recibos (iframe con el HTML imprimible del servidor) ---------- */
.cl-inv-view iframe { min-height: 34rem; }
.cl-inv-view iframe:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (max-width: 768px) { .cl-inv-view { padding: .5rem; } .cl-inv-view iframe { min-height: 28rem; } }
