:root {
    --rojo: #d32f2f;
    --rojo-dark: #9f0000;
    --rojo-soft: #fdeaea;
    --gris: #eeeeee;
    --gris-2: #f7f7f7;
    --gris-3: #d6d6d6;
    --white: #ffffff;
    --page: #f4f4f4;
    --text: #202020;
    --muted: #6d6d6d;
    --line: #dddddd;
    --shadow: 0 16px 34px rgba(120, 0, 0, .16);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page);
    color: var(--text);
}

.app-shell {
    min-height: 100vh;
    padding-bottom: 84px;
    background:
    radial-gradient(circle at 12% 0%, rgba(211,47,47,.16), transparent 32%),
    radial-gradient(circle at 90% 8%, rgba(80,80,80,.10), transparent 30%),
    var(--page);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    cursor: pointer;
}

.brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: contain;
    background: #f5e9e9;
    padding: 4px;
    box-shadow: 0 8px 18px rgba(120,0,0,.22);
    flex: 0 0 auto;
}

.brand-title { line-height: 1.1; min-width: 0; }
.brand-title strong {
    display: block;
    font-size: 16px;
    color: var(--rojo-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-title span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.desktop-nav { display: none; gap: 8px; }
.desktop-nav button,
.bottom-nav button,
.mode-option,
.category-tab,
.action-card,
.back-button { font: inherit; }

.desktop-nav button {
    border: 1px solid transparent;
    color: var(--rojo-dark);
    background: transparent;
    padding: 10px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
}

.desktop-nav button.active {
    color: white;
    border-color: var(--rojo);
    background: var(--rojo);
}


.mode-toggle {
    border: 1px solid rgba(211,47,47,.28);
    background: #fff;
    border-radius: 999px;
    padding: 3px;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(211,47,47,.12);
    display: none;
    align-items: center;
    gap: 2px;
}

.mode-toggle::after {
    content: "↔";
    font-size: 12px;
    opacity: .9;
}

.mode-option {
    border: 0;
    background: transparent;
    color: var(--rojo-dark);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.mode-option.active {
    background: var(--rojo);
    color: white;
    box-shadow: 0 6px 14px rgba(211,47,47,.22);
}

.mode-toggle::after {
    content: none;
    display: none;
}

.mode-toggle.show {
    display: inline-flex;
}

.hero {
    max-width: 1160px;
    margin: 0 auto;
    padding: 18px 16px 16px;
    transition: all .35s ease;
}

.hero.compact {
    padding-top: 8px;
    padding-bottom: 6px;
}

.hero-card {
    min-height: 430px;
    border-radius: 30px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    background:
    linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.72)),
    url("../images/fondo.jpg") center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    transition: all .38s ease;
}

.hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
    radial-gradient(circle at center, rgba(255,255,255,.08), transparent 42%),
    linear-gradient(180deg, rgba(120,0,0,.05), rgba(120,0,0,.28));
    z-index: 0;
}

.hero.compact .hero-card {
    min-height: 140px;
    border-radius: 24px;
    padding: 16px;
    background-position: center 38%;
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    color: white;
    text-shadow: 0 3px 14px rgba(0,0,0,.42);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-logo {
    width: min(330px, 72vw);
    max-height: 280px;
    object-fit: contain;
    margin-bottom: 28px;
    filter:
    drop-shadow(0 10px 26px rgba(0,0,0,.48))
    drop-shadow(0 0 10px rgba(255,255,255,.24));
}

.hero.compact .hero-logo {
    width: min(125px, 38vw);
    max-height: 100px;
    margin-bottom: 10px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(30px, 6vw, 52px);
    line-height: .95;
    letter-spacing: -.03em;
    text-transform: uppercase;
    font-weight: 900;
}

.hero.compact h1 {
    font-size: clamp(18px, 4vw, 28px);
    letter-spacing: -.02em;
}

.hero p {
    color: rgba(255,255,255,.94);
    margin: 14px 0 0;
    max-width: 620px;
    font-size: 16px;
    line-height: 1.45;
}

.hero.compact p { display: none; }

.main {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 16px 28px;
}

.section { display: none; animation: fadeIn .18s ease-out; }
.section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.action-card {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--text);
    border-radius: 22px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(120,0,0,.08);
    text-align: left;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(120,0,0,.14);
    border-color: rgba(211,47,47,.35);
}

.action-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff, var(--rojo-soft));
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
}

.action-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.action-icon svg {
    width: 42px;
    height: 42px;
}

.action-card strong {
    display: block;
    font-size: 17px;
    margin-bottom: 4px;
    color: var(--rojo-dark);
}

.action-card span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.panel {
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: linear-gradient(90deg, var(--rojo-soft), white);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title h2 {
    margin: 0;
    font-size: 18px;
    color: var(--rojo-dark);
}

.back-button {
    border: 1px solid var(--line);
    background: white;
    color: var(--rojo-dark);
    border-radius: 999px;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 700;
}

.category-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 2px;
    scrollbar-width: none;
}

.category-row::-webkit-scrollbar { display: none; }

.category-tab {
    border: 1px solid var(--rojo);
    background: white;
    color: var(--rojo-dark);
    padding: 9px 14px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 800;
    min-width: 58px;
    /*font-size: 14px;*/
}

.category-tab.active {
    background: var(--rojo);
    color: white;
    box-shadow: 0 8px 20px rgba(211,47,47,.24);
}

.category-tab.damas {
    border-color: #6e6e6e;
    color: #4a4a4a;
}

.category-tab.damas.active {
    background: #555;
    color: white;
    box-shadow: 0 8px 20px rgba(80,80,80,.22);
}

.iframe-wrap {
    position: relative;
    background: white;
    overflow: hidden;
    border-radius: 18px;
    height: 3600px;
}

.iframe-wrap-form {
    height: 1200px;
}

.sheet-frame {
    display: block;
    width: 100%;
    border: 0;
    background: white;
    transform: translateY(-34px);
    height: 4000px;
}

.visor-empty {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: start center;
    padding: 54px 24px;
    background: white;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
    line-height: 1.45;
}

.visor-empty[hidden] {
    display: none;
}

.form-frame {
    transform: translateY(-48px);
    height: 1280px;
}

.loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 42px;
    background: rgba(255,255,255,.92);
    z-index: 2;
}

.loader.show { display: flex; }

.spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid #e5e5e5;
    border-top-color: var(--rojo);
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    padding: 7px 6px 9px;
    box-shadow: 0 -10px 24px rgba(120,0,0,.10);
}

.bottom-nav button {
    border: 0;
    background: transparent;
    color: var(--muted);
    display: grid;
    gap: 3px;
    justify-items: center;
    font-size: 11px;
    cursor: pointer;
    padding: 6px 2px;
    border-radius: 14px;
    font-weight: 700;
}

.bottom-nav button .nav-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    margin-bottom: 2px;
}

.bottom-nav button.active {
    color: var(--rojo-dark);
    background: var(--rojo-soft);
}

.placeholder {
    padding: 26px 18px;
    color: var(--muted);
    line-height: 1.5;
}

.home-carousel {
    margin-top: 18px;
    border-radius: 24px;
    overflow: hidden;
    background: white;
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(120,0,0,.10);
}

.carousel-frame {
    position: relative;
    height: min(92vh, 720px);
    background: #ffffff;
    overflow: hidden;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .7s ease;
    background: #ffffff;
}

.carousel-slide.active { opacity: 1; }

@media (max-width: 520px) {
    .topbar-inner { padding: 9px 12px; gap: 8px; }
    .brand { flex: 1 1 auto; min-width: 0; }
    .mode-option { padding: 6px 9px; font-size: 12px; }
    .brand-logo { width: 42px; height: 42px; }
    .brand-title strong { font-size: 14px; }
    .hero { padding: 12px; }
    .hero-card {
    min-height: 620px;
    border-radius: 26px;
    padding: 24px;
    background-position: center;
    }
    .hero-logo {
    width: min(280px, 78vw);
    max-height: 240px;
    }
    .hero p { font-size: 14px; }
    .main { padding-left: 12px; padding-right: 12px; }
    .sheet-frame { height: 4000px; }
    .iframe-wrap-form { height: 1120px; }
    .form-frame { height: 1200px; }
    .carousel-frame { height: min(82vh, 680px); }
}

@media (min-width: 720px) {
    .desktop-nav { display: flex; }
    .bottom-nav { display: none; }
    .app-shell { padding-bottom: 0; }
    .grid { grid-template-columns: repeat(2, 1fr); }
    .hero { padding-top: 24px; }
    .sheet-frame { height: 4000px; }
    .form-frame { height: 1280px; }
}

@media (min-width: 1024px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}
