/* ═══════════════════════════════════════════════════════════════════════════
   Cotizador TallerControl — hoja de estilos
   Mobile first: el diseño base es el de móvil; las media queries solo suman.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Página ───────────────────────────────────────────────────────────────
   En móvil el cotizador ocupa la pantalla entera y el cromo del sitio se
   retira: navbar y footer robarían la altura que necesita la conversación.
   El botón de volver del primer paso hace de salida al sitio.              */
.tc-body {
    margin: 0;
    background: #f4f5fb;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: clip;
    /* Quita el zoom por doble toque y, de paso, el retardo de 300 ms que
       algunos navegadores móviles esperan para distinguirlo de un toque. */
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.tc-site-chrome { display: none; }

@media (min-width: 992px) {
    .tc-site-chrome { display: block; }
    .tc-body { background: #f4f5fb; }
}

/* Navbar y footer del sitio (solo escritorio) */
.navbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #e2e8f0;
    padding: .7rem 0;
}
.navbar-brand img { max-height: 36px; }
.nav-link { font-weight: 600; color: #64748b; font-size: .875rem; transition: color .2s; text-decoration: none; }
.nav-link:hover, .nav-link.active { color: #5550ff; }
.navbar .btn { border-radius: 12px; font-weight: 700; padding: 10px 20px; font-size: .875rem; border: 1.5px solid transparent; transition: all .25s ease; }
.navbar .btn-primary { background: #5550ff; border-color: #5550ff; color: #fff; box-shadow: 0 8px 28px rgba(85, 80, 255, .28); }
.navbar .btn-primary:hover { background: #4340d4; border-color: #4340d4; color: #fff; transform: translateY(-1px); }
.navbar .btn-outline-dark { background: transparent; border-color: #e2e8f0; color: #64748b; }
.navbar .btn-outline-dark:hover { background: #0f172a; color: #fff; border-color: #0f172a; }
.tc-nuevo { font-size: .6rem; white-space: nowrap; transform: translate(-50%, -50%); }

.site-footer { background: #0f172a; color: #cbd5e1; padding: 4rem 0 1.5rem; }
.site-footer a { color: #94a3b8; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-brand img { max-height: 38px; margin-bottom: 1rem; }
.footer-tagline { color: #94a3b8; line-height: 1.75; max-width: 360px; font-size: .875rem; }
.footer-col-title { font-size: .9rem; font-weight: 800; color: #fff; margin-bottom: 1rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li + li { margin-top: .75rem; }
.footer-links a { font-size: .875rem; }
.footer-contact-items { display: flex; flex-direction: column; gap: 1rem; }
.footer-contact-item { display: flex; align-items: flex-start; gap: .8rem; color: #94a3b8; font-size: .875rem; line-height: 1.6; }
.footer-contact-item i { color: #fff; margin-top: .2rem; }
.footer-divider { height: 1px; background: rgba(255, 255, 255, .08); margin: 2.5rem 0 1.5rem; }
.footer-bottom p { margin: 0; color: #94a3b8; font-size: .85rem; }
.footer-bottom a { color: #fff; }

/* Los tokens viven en :root, no en .tc-app: la hoja del carrito se monta
   fuera de ese contenedor y sus var() quedarían sin resolver —fondo
   transparente y contenido ilegible. */
:root {
    /* Marca */
    --tc-primary: #5550ff;
    --tc-primary-dark: #4340d4;
    --tc-primary-soft: #f0efff;
    --tc-primary-tint: #fafaff;

    /* Semánticos */
    --tc-success: #059669;
    --tc-success-soft: #d1fae5;
    --tc-danger: #dc2626;
    --tc-warning-soft: #fef3c7;
    --tc-warning-ink: #92400e;

    /* Superficies y texto */
    --tc-bg: #f4f5fb;
    --tc-surface: #ffffff;
    --tc-ink: #0f172a;
    --tc-ink-soft: #475569;
    --tc-ink-faint: #94a3b8;
    --tc-line: #e4e7ee;
    --tc-line-soft: #eef1f6;

    /* Ritmo */
    --tc-r-sm: 10px;
    --tc-r-md: 14px;
    --tc-r-lg: 20px;
    --tc-r-full: 999px;

    --tc-sh-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --tc-sh-md: 0 4px 14px rgba(15, 23, 42, .07);
    --tc-sh-up: 0 -6px 24px rgba(15, 23, 42, .09);

    /* Alturas del cromo: declaradas para que el área de contenido las reste. */
    --tc-h-header: 48px;
    --tc-h-progreso: 3px;
    --tc-h-barra: 76px;
}

.tc-app,
.tc-sheet-backdrop {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--tc-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tc-app *,
.tc-app *::before,
.tc-app *::after,
.tc-sheet-backdrop *,
.tc-sheet-backdrop *::before,
.tc-sheet-backdrop *::after { box-sizing: border-box; }

/* ─── Armazón ──────────────────────────────────────────────────────────────
   En móvil ocupa la ventana completa y solo scrollea el área de conversación.
   `100dvh` evita que la barra del navegador tape la barra de total.          */
.tc-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--tc-bg);
    overflow: hidden;
}

.tc-app :focus-visible,
.tc-sheet-backdrop :focus-visible {
    outline: 2px solid var(--tc-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* El armazón hereda la altura para que solo scrollee el hilo y la barra de
   total quede anclada abajo. */
.tc-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ─── Cabecera ─────────────────────────────────────────────────────────── */
.tc-header {
    display: flex;
    align-items: center;
    gap: .625rem;
    height: var(--tc-h-header);
    padding: 0 .5rem 0 .375rem;
    background: var(--tc-surface);
    border-bottom: 1px solid var(--tc-line);
    flex-shrink: 0;
}

.tc-back {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: var(--tc-r-full);
    color: var(--tc-ink-soft);
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s, color .18s;
}
.tc-back:hover { background: var(--tc-line-soft); color: var(--tc-ink); }
.tc-back[disabled] { opacity: .3; cursor: default; }
.tc-back[disabled]:hover { background: none; color: var(--tc-ink-soft); }

.tc-header-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: .5rem;
}
.tc-header-title strong {
    font-size: .9375rem;
    font-weight: 700;
    letter-spacing: -.01em;
    white-space: nowrap;
}
.tc-header-title span {
    font-size: .75rem;
    color: var(--tc-ink-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tc-step-count {
    font-size: .75rem;
    font-weight: 700;
    color: var(--tc-ink-faint);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    padding-right: .375rem;
}

/* Selector de moneda: ajuste global, por eso vive en la cabecera y está
   disponible desde el primer paso. */
.tc-currency {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: var(--tc-bg);
    border-radius: var(--tc-r-full);
    flex-shrink: 0;
}
.tc-currency button {
    border: none;
    background: none;
    border-radius: var(--tc-r-full);
    padding: .1875rem .5rem;
    font-family: inherit;
    font-size: .6875rem;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--tc-ink-faint);
    cursor: pointer;
    transition: background .18s, color .18s, box-shadow .18s;
}
.tc-currency button:hover { color: var(--tc-ink-soft); }
.tc-currency button.is-on {
    background: var(--tc-surface);
    color: var(--tc-primary);
    box-shadow: var(--tc-sh-sm);
}

/* Bajo 380 px el subtítulo cede su espacio al selector. */
@media (max-width: 379px) {
    .tc-header-title span { display: none; }
}

/* Progreso: una sola línea, sin etiquetas que roben altura. */
.tc-progress {
    height: var(--tc-h-progreso);
    background: var(--tc-line-soft);
    flex-shrink: 0;
}
.tc-progress-bar {
    height: 100%;
    background: var(--tc-primary);
    border-radius: 0 var(--tc-r-full) var(--tc-r-full) 0;
    transition: width .45s cubic-bezier(.22, .61, .36, 1);
}

/* ─── Conversación ─────────────────────────────────────────────────────── */
/* Sin `scroll-behavior: smooth` a propósito: declarado en CSS se impone sobre
   el `behavior` que pide scrollTo(), y el desplazamiento instantáneo deja de
   funcionar —el hilo se queda arriba al restaurar una sesión. El suavizado lo
   decide el JS en cada llamada. */
.tc-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.tc-thread {
    padding: 1rem .875rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

/* Un grupo reúne los mensajes seguidos del mismo emisor: el avatar aparece
   una sola vez, como en las apps de mensajería. */
.tc-group {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
}
.tc-group + .tc-group { margin-top: .625rem; }
.tc-group.is-user { flex-direction: row-reverse; }

.tc-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--tc-r-full);
    background: var(--tc-primary-soft);
    color: var(--tc-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8125rem;
    flex-shrink: 0;
    margin-bottom: 1px;
}
.tc-group.is-user .tc-avatar { display: none; }

.tc-bubbles {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    min-width: 0;
    max-width: calc(100% - 36px);
}
.tc-group.is-user .tc-bubbles { align-items: flex-end; max-width: 82%; }

.tc-bubble {
    background: var(--tc-surface);
    border-radius: var(--tc-r-md);
    padding: .625rem .8125rem;
    font-size: .9375rem;
    line-height: 1.5;
    color: var(--tc-ink);
    box-shadow: var(--tc-sh-sm);
    max-width: 100%;
}
.tc-bubble:first-child { border-top-left-radius: var(--tc-r-lg); }
.tc-bubble:last-child { border-bottom-left-radius: 4px; }
.tc-bubble strong { font-weight: 700; }

.tc-group.is-user .tc-bubble {
    background: var(--tc-primary);
    color: #fff;
    box-shadow: none;
}
.tc-group.is-user .tc-bubble:last-child {
    border-bottom-left-radius: var(--tc-r-md);
    border-bottom-right-radius: 4px;
}

/* Aparición de burbujas: corta, y anulada si el usuario prefiere menos
   movimiento. El teatro no debe retrasar una tarea comercial. */
.tc-enter { animation: tcEnter .22s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes tcEnter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.tc-typing {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: .75rem .875rem;
    background: var(--tc-surface);
    border-radius: var(--tc-r-md);
    border-bottom-left-radius: 4px;
    box-shadow: var(--tc-sh-sm);
    width: fit-content;
}
.tc-typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tc-ink-faint);
    animation: tcBlink 1.1s infinite;
}
.tc-typing i:nth-child(2) { animation-delay: .16s; }
.tc-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes tcBlink {
    0%, 60%, 100% { opacity: .25; }
    30% { opacity: 1; }
}

/* ─── Bloque de opciones ───────────────────────────────────────────────────
   Vive en el hilo, no dentro de una burbuja: así el contenido largo usa el
   scroll de la página en lugar de crear un segundo scroll anidado.          */
.tc-options {
    margin: .5rem 0 .25rem 36px;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.tc-group.is-user + .tc-options { margin-left: 0; }

.tc-options-label {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--tc-ink-faint);
    margin: .25rem 0 0;
}

/* ─── Tarjeta de opción (módulos) ──────────────────────────────────────── */
.tc-option {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    column-gap: .75rem;
    row-gap: .125rem;
    align-items: center;
    width: 100%;
    padding: .75rem .875rem;
    background: var(--tc-surface);
    border: 1.5px solid var(--tc-line);
    border-radius: var(--tc-r-md);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color .18s, background .18s, box-shadow .18s;
    -webkit-tap-highlight-color: transparent;
}
.tc-option:hover { border-color: #c7c5ff; }
.tc-option.is-on {
    border-color: var(--tc-primary);
    background: var(--tc-primary-tint);
    box-shadow: 0 0 0 3px rgba(85, 80, 255, .09);
}

.tc-option-icon {
    grid-row: 1 / 3;
    width: 36px;
    height: 36px;
    border-radius: var(--tc-r-sm);
    background: var(--tc-primary-soft);
    color: var(--tc-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background .18s;
}
.tc-option.is-on .tc-option-icon { background: rgba(85, 80, 255, .16); }

/* El nombre identifica al producto: puede envolver, nunca se recorta. */
.tc-option-name {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 .375rem;
}

/* El precio abre la segunda línea, así se lee antes que la descripción. */
.tc-option-meta {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: .375rem;
    font-size: .75rem;
    line-height: 1.4;
}
.tc-option-price {
    font-weight: 800;
    color: var(--tc-primary);
    white-space: nowrap;
    flex-shrink: 0;
}
.tc-option-desc {
    color: var(--tc-ink-soft);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.tc-option-desc::before { content: '· '; color: var(--tc-ink-faint); }

.tc-badge {
    font-size: .625rem;
    font-weight: 800;
    background: var(--tc-warning-soft);
    color: var(--tc-warning-ink);
    border: 1px solid #fde68a;
    padding: 0 .375rem;
    border-radius: var(--tc-r-full);
    line-height: 1.5;
}

/* Interruptor */
.tc-switch {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    width: 38px;
    height: 22px;
    border-radius: var(--tc-r-full);
    background: #d7dbe4;
    position: relative;
    flex-shrink: 0;
    transition: background .2s;
}
.tc-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
    transition: transform .2s cubic-bezier(.34, 1.4, .64, 1);
}
.tc-option.is-on .tc-switch { background: var(--tc-primary); }
.tc-option.is-on .tc-switch::after { transform: translateX(16px); }

/* ─── Contador (sucursales) ────────────────────────────────────────────── */
.tc-counter {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .875rem;
    background: var(--tc-surface);
    border: 1.5px solid var(--tc-line);
    border-radius: var(--tc-r-md);
}
.tc-counter-info { flex: 1; min-width: 0; }
.tc-counter-info p { margin: 0; }
.tc-counter-info .tc-counter-title { font-size: .875rem; font-weight: 700; }
.tc-counter-info .tc-counter-note { font-size: .75rem; color: var(--tc-ink-soft); line-height: 1.4; }

.tc-stepper {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-shrink: 0;
    background: var(--tc-bg);
    border-radius: var(--tc-r-sm);
    padding: 3px;
}
.tc-stepper button {
    width: 34px;
    height: 34px;
    border: none;
    background: var(--tc-surface);
    border-radius: 8px;
    color: var(--tc-ink);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--tc-sh-sm);
    font-family: inherit;
    transition: color .15s, background .15s;
}
.tc-stepper button:hover:not(:disabled) { background: var(--tc-primary); color: #fff; }
.tc-stepper button:disabled { opacity: .35; cursor: default; box-shadow: none; }
.tc-stepper output {
    min-width: 30px;
    text-align: center;
    font-size: .9375rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ─── Ciclos de facturación ────────────────────────────────────────────── */
.tc-cycles { display: flex; flex-direction: column; gap: .5rem; }

.tc-cycle {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: .75rem;
    padding: .8125rem .875rem;
    background: var(--tc-surface);
    border: 1.5px solid var(--tc-line);
    border-radius: var(--tc-r-md);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color .18s, background .18s, box-shadow .18s;
}
.tc-cycle:hover { border-color: #c7c5ff; }
.tc-cycle.is-on {
    border-color: var(--tc-primary);
    background: var(--tc-primary-tint);
    box-shadow: 0 0 0 3px rgba(85, 80, 255, .09);
}
.tc-cycle.is-locked { opacity: .5; cursor: not-allowed; }

.tc-cycle-name {
    font-size: .875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .375rem;
    flex-wrap: wrap;
}
.tc-cycle-note {
    font-size: .75rem;
    color: var(--tc-ink-soft);
    margin: .125rem 0 0;
}
.tc-cycle-amount { text-align: right; white-space: nowrap; }
.tc-cycle-amount strong {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.tc-cycle-amount span {
    display: block;
    font-size: .6875rem;
    color: var(--tc-ink-faint);
}
.tc-cycle.is-on .tc-cycle-amount strong { color: var(--tc-primary); }

.tc-save {
    font-size: .6875rem;
    font-weight: 800;
    color: var(--tc-success);
    background: var(--tc-success-soft);
    border-radius: var(--tc-r-full);
    padding: 1px .5rem;
    line-height: 1.5;
}
.tc-tag-popular {
    font-size: .625rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #422006;
    border-radius: var(--tc-r-full);
    padding: 1px .5rem;
    line-height: 1.5;
}

/* ─── Cupón ────────────────────────────────────────────────────────────── */
.tc-coupon { display: flex; gap: .5rem; }
.tc-input {
    flex: 1;
    min-width: 0;
    border: 1.5px solid var(--tc-line);
    border-radius: var(--tc-r-md);
    padding: .6875rem .875rem;
    /* 16px exactos y ni un pixel menos: iOS amplía la página al enfocar
       cualquier campo con tipografía menor, y luego no la devuelve. */
    font-size: 1rem;
    font-family: inherit;
    color: var(--tc-ink);
    background: var(--tc-surface);
    outline: none;
    transition: border-color .18s, box-shadow .18s;
}
.tc-input::placeholder { color: var(--tc-ink-faint); }
.tc-input:focus { border-color: var(--tc-primary); box-shadow: 0 0 0 3px rgba(85, 80, 255, .12); }
.tc-input.is-error { border-color: var(--tc-danger); }

.tc-feedback {
    font-size: .75rem;
    color: var(--tc-ink-soft);
    margin: .375rem 0 0;
    line-height: 1.45;
}
.tc-feedback.is-error { color: var(--tc-danger); }
.tc-feedback.is-success { color: var(--tc-success); }

/* ─── Botones ──────────────────────────────────────────────────────────── */
.tc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4375rem;
    padding: .75rem 1.125rem;
    border: 1.5px solid transparent;
    border-radius: var(--tc-r-md);
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background .18s, border-color .18s, color .18s, transform .12s;
}
.tc-btn:active { transform: scale(.985); }
.tc-btn-primary { background: var(--tc-primary); color: #fff; }
.tc-btn-primary:hover { background: var(--tc-primary-dark); color: #fff; }
.tc-btn-ghost { background: var(--tc-surface); border-color: var(--tc-line); color: var(--tc-ink-soft); }
.tc-btn-ghost:hover { border-color: var(--tc-ink-faint); color: var(--tc-ink); }
.tc-btn-block { width: 100%; }
.tc-btn[disabled] { opacity: .5; cursor: default; transform: none; }

.tc-actions { display: flex; gap: .5rem; }
.tc-actions .tc-btn { flex: 1; }

/* ─── Barra inferior: total permanente + acción ────────────────────────────
   El requisito es que el importe esté visible en todo momento, no escondido
   tras un contador. Total y acción comparten una sola barra para no gastar
   dos veces la altura.                                                      */
.tc-bar {
    flex-shrink: 0;
    background: var(--tc-surface);
    border-top: 1px solid var(--tc-line);
    box-shadow: var(--tc-sh-up);
    padding: .75rem .875rem;
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    gap: .875rem;
    min-height: var(--tc-h-barra);
}

.tc-bar-total {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    padding: 0;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    display: block;
}
.tc-bar-label {
    display: flex;
    align-items: center;
    gap: .25rem;
    font-size: .6875rem;
    font-weight: 600;
    color: var(--tc-ink-faint);
    line-height: 1.3;
}
.tc-bar-label i { font-size: .625rem; transition: transform .22s; }
.tc-bar-total[aria-expanded="true"] .tc-bar-label i { transform: rotate(180deg); }

.tc-bar-amount {
    display: flex;
    align-items: baseline;
    gap: .3125rem;
    font-size: 1.375rem;
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.tc-bar-amount small {
    font-size: .6875rem;
    font-weight: 600;
    color: var(--tc-ink-faint);
    letter-spacing: 0;
    white-space: nowrap;
}
.tc-bar .tc-btn { flex-shrink: 0; }

/* Paso final: el importe ya preside la tarjeta de resumen, así que repetirlo
   en la barra solo le robaría ancho al botón de cierre. */
.tc-bar.is-final .tc-bar-total { display: none; }
.tc-bar.is-final .tc-btn { flex: 1; }

/* Detalle del carrito, desplegado desde la barra */
.tc-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 60;
    display: flex;
    align-items: flex-end;
    animation: tcFade .18s ease both;
}
.tc-sheet-backdrop[hidden] { display: none; }
@keyframes tcFade { from { opacity: 0; } to { opacity: 1; } }

.tc-sheet {
    width: 100%;
    max-height: 78vh;
    display: flex;
    flex-direction: column;
    background: var(--tc-surface);
    border-radius: var(--tc-r-lg) var(--tc-r-lg) 0 0;
    animation: tcRise .26s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes tcRise { from { transform: translateY(100%); } to { transform: none; } }

.tc-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem .5rem;
    flex-shrink: 0;
}
.tc-sheet-head h2 { font-size: 1rem; font-weight: 800; margin: 0; }
.tc-sheet-close {
    width: 34px;
    height: 34px;
    border: none;
    background: var(--tc-bg);
    border-radius: var(--tc-r-full);
    color: var(--tc-ink-soft);
    cursor: pointer;
    font-size: .9375rem;
}
.tc-sheet-body { overflow-y: auto; padding: 0 1rem; flex: 1; min-height: 0; }
.tc-sheet-foot {
    padding: .75rem 1rem;
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--tc-line);
    flex-shrink: 0;
}

/* ─── Renglones de importe ─────────────────────────────────────────────── */
.tc-lines { display: flex; flex-direction: column; }

.tc-line {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .75rem;
    padding: .6875rem 0;
    border-bottom: 1px solid var(--tc-line-soft);
}
.tc-line:last-child { border-bottom: none; }
.tc-line-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--tc-primary-soft);
    color: var(--tc-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
}
.tc-line-name { font-size: .875rem; font-weight: 600; line-height: 1.3; }
.tc-line-note { font-size: .6875rem; color: var(--tc-ink-faint); line-height: 1.35; }
.tc-line-amount {
    font-size: .875rem;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tc-line-amount.is-free { color: var(--tc-ink-faint); font-weight: 600; }

.tc-totals {
    border-top: 1px solid var(--tc-line);
    margin-top: .25rem;
    padding-top: .75rem;
    display: flex;
    flex-direction: column;
    gap: .4375rem;
}
.tc-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-size: .875rem;
}
.tc-total-row span { color: var(--tc-ink-soft); }
.tc-total-row strong { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tc-total-row.is-discount span,
.tc-total-row.is-discount strong { color: var(--tc-success); }
.tc-total-row.is-grand {
    border-top: 1px solid var(--tc-line);
    margin-top: .25rem;
    padding-top: .625rem;
}
.tc-total-row.is-grand span { font-size: .9375rem; font-weight: 800; color: var(--tc-ink); }
.tc-total-row.is-grand strong { font-size: 1.25rem; font-weight: 900; color: var(--tc-primary); letter-spacing: -.02em; }

.tc-hint {
    font-size: .75rem;
    color: var(--tc-ink-faint);
    line-height: 1.45;
    margin: .625rem 0 0;
    display: flex;
    align-items: flex-start;
    gap: .375rem;
}
.tc-hint i { color: var(--tc-success); margin-top: .1875rem; font-size: .6875rem; }

/* ─── Resumen final ────────────────────────────────────────────────────── */
.tc-summary {
    background: var(--tc-surface);
    border: 1.5px solid var(--tc-line);
    border-radius: var(--tc-r-lg);
    overflow: hidden;
    box-shadow: var(--tc-sh-md);
}
.tc-summary-hero {
    padding: 1.25rem 1.125rem;
    background: linear-gradient(135deg, var(--tc-primary) 0%, #7c3aed 100%);
    color: #fff;
}
.tc-summary-hero p {
    margin: 0;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .65);
}
.tc-summary-hero .tc-summary-amount {
    display: flex;
    align-items: baseline;
    gap: .375rem;
    margin-top: .25rem;
}
.tc-summary-hero strong {
    font-size: 2.25rem;
    font-weight: 900;
    letter-spacing: -.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.tc-summary-hero small { font-size: .8125rem; font-weight: 600; color: rgba(255, 255, 255, .7); }
.tc-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: .3125rem;
    margin-top: .625rem;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: var(--tc-r-full);
    padding: .1875rem .625rem;
    font-size: .75rem;
    font-weight: 700;
}
.tc-summary-body { padding: 1rem 1.125rem 1.125rem; }

.tc-accordion {
    display: flex;
    align-items: center;
    gap: .375rem;
    width: 100%;
    background: none;
    border: none;
    padding: .75rem 0 0;
    font-family: inherit;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--tc-ink-soft);
    cursor: pointer;
}
.tc-accordion:hover { color: var(--tc-primary); }
.tc-accordion i { font-size: .6875rem; transition: transform .22s; }
.tc-accordion[aria-expanded="true"] i { transform: rotate(180deg); }
.tc-accordion-panel {
    margin-top: .625rem;
    padding: .75rem .875rem;
    background: var(--tc-bg);
    border-radius: var(--tc-r-sm);
}
.tc-accordion-panel[hidden] { display: none; }

.tc-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: .75rem;
}
.tc-trust span {
    display: inline-flex;
    align-items: center;
    gap: .3125rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--tc-ink-faint);
}
.tc-trust i { color: var(--tc-success); }

/* ─── Carril lateral: solo escritorio ──────────────────────────────────── */
.tc-rail { display: none; }

/* ═══ ESCRITORIO ═══════════════════════════════════════════════════════════
   A partir de 992px el cotizador deja de ser pantalla completa y se integra
   en la página, con el carrito permanente a un lado.                        */
@media (min-width: 992px) {
    .tc-app {
        height: auto;
        overflow: visible;
        background: transparent;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 336px;
        align-items: start;
        gap: 1.75rem;
        max-width: 1060px;
        margin: 0 auto;
        padding: 2rem 1.25rem 4rem;
    }

    .tc-shell {
        flex: none;
        background: var(--tc-surface);
        border: 1px solid var(--tc-line);
        border-radius: var(--tc-r-lg);
        box-shadow: var(--tc-sh-md);
        overflow: hidden;
    }

    .tc-header {
        height: 56px;
        background: var(--tc-surface);
    }

    .tc-scroll {
        max-height: min(620px, calc(100vh - 220px));
        background: var(--tc-bg);
    }
    .tc-thread { padding: 1.25rem 1.125rem 1.5rem; }

    /* En escritorio el total vive en el carril, así que la barra solo actúa. */
    .tc-bar { box-shadow: none; padding: .875rem 1.125rem; }
    .tc-bar-total { display: none; }
    .tc-bar .tc-btn { flex: 1; }

    .tc-rail {
        display: block;
        position: sticky;
        top: 88px;
    }
    .tc-rail-card {
        background: var(--tc-surface);
        border: 1px solid var(--tc-line);
        border-radius: var(--tc-r-lg);
        box-shadow: var(--tc-sh-md);
        overflow: hidden;
    }
    .tc-rail-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .9375rem 1.125rem;
        border-bottom: 1px solid var(--tc-line-soft);
    }
    .tc-rail-head h2 {
        font-size: .8125rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .07em;
        color: var(--tc-ink-faint);
        margin: 0;
    }
    .tc-rail-count {
        min-width: 22px;
        height: 22px;
        padding: 0 .375rem;
        border-radius: var(--tc-r-full);
        background: var(--tc-primary-soft);
        color: var(--tc-primary);
        font-size: .75rem;
        font-weight: 800;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .tc-rail-body { padding: .375rem 1.125rem 1.125rem; }

    /* El detalle inferior deja de ser hoja modal y se integra en el carril. */
    .tc-sheet-backdrop {
        position: static;
        background: none;
        display: block;
        animation: none;
    }
    .tc-sheet {
        max-height: none;
        border-radius: 0;
        animation: none;
        background: transparent;
    }
    .tc-sheet-head, .tc-sheet-foot { display: none; }
    .tc-sheet-body { padding: 0; overflow: visible; }

    .tc-options { margin-left: 36px; }
    .tc-bubbles { max-width: min(78%, 460px); }
}

/* ─── Accesibilidad ────────────────────────────────────────────────────── */
.tc-app :focus-visible {
    outline: 2px solid var(--tc-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.tc-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .tc-app *,
    .tc-app *::before,
    .tc-app *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
