:root {
    --primary: #1e293b;
    --accent: #ff8c00;
    --success: #10b981;
    --danger: #ef4444;
    --blue: #2563eb;
    --bg-light: #f4f7f6;
    --border: #e2e8f0;
    --text-main: #334155;
    --text-muted: #64748b;
    --white: #ffffff;
    --shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
    --brand-forest: #0d3027;
    --brand-green: #0d6b52;
    --brand-soft: #eef7f3;
    --brand-line: #d9e5e0;
    --brand-ink: #102a23;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--white);
    color: var(--text-main);
    min-height: 100dvh;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: max(10px, env(safe-area-inset-top)) 18px 10px;
    background: var(--white);
    color: var(--primary);
}
.header-logo-btn {
    height: 44px;
    max-width: min(210px, calc(100vw - 140px));
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    min-width: 0;
}
.header-logo-btn img {
    max-width: 100%;
    max-height: 44px;
    object-fit: contain;
    display: block;
}
.header-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}
.brand-block { display: none; }
.brand-block strong { display: block; font-size: 1rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-block span { display: block; color: #cbd5e1; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--white);
    position: relative;
}
.icon-btn.ghost { background: rgba(255,255,255,0.1); }
.app-header .icon-btn.ghost { background: #f1f5f9; color: var(--primary); }
.icon-btn.dark { color: var(--primary); background: #eef2f7; }
.cart-trigger span {
    position: absolute;
    right: -5px;
    top: -5px;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--success);
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid var(--white);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cart-trigger.bump span {
    animation: cartCountBump 0.58s ease;
}
@keyframes cartCountBump {
    0% { transform: scale(1); }
    28% { transform: scale(1.9); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.22); }
    68% { transform: scale(1.45); }
    100% { transform: scale(1); box-shadow: none; }
}

.app-shell { max-width: 1180px; margin: 0 auto; padding: 12px 16px 16px; }
.view { display: none; }
.view.active { display: block; }
.toolbar, .menu-tools {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
}
.toolbar { align-items: stretch; }
.view-businesses > .toolbar {
    position: sticky;
    z-index: 20;
    top: 64px;
    padding: 12px 0;
    margin-top: -12px;
    background: var(--white);
}
.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.search-box i { color: var(--accent); }
.search-box input { width: 100%; border: none; outline: none; background: transparent; color: var(--text-main); }
.search-box.compact { max-width: 360px; }
.map-btn {
    width: 52px;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    color: var(--blue);
    display: inline-grid;
    place-items: center;
    font-size: 1.15rem;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}
.map-btn:hover { color: var(--white); background: var(--brand-green); }
.client-map-panel {
    position: relative;
    min-height: 480px;
    margin: -2px 0 20px;
    overflow: hidden;
    border: 1px solid rgba(27, 71, 57, .12);
    border-radius: 16px;
    background: #d9e8ee;
    box-shadow: 0 12px 28px rgba(15, 47, 38, .1);
}
.client-map-panel[hidden] { display: none !important; }
.client-map-toolbar {
    position: absolute;
    z-index: 500;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
}
.client-map-toolbar > div:not(.client-map-actions), .client-map-toolbar button {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 11px;
    color: var(--brand-ink);
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 8px 22px rgba(20, 54, 43, .12);
    backdrop-filter: blur(12px);
    pointer-events: auto;
}
.client-map-toolbar strong { font-size: .78rem; }
.client-map-toolbar button { cursor: pointer; font-size: .75rem; font-weight: 800; }
.client-map-toolbar button:hover { background: var(--brand-soft); }
.client-map-actions { display: flex; gap: 7px; pointer-events: auto; }
#cliente-huelva-map { min-height: 480px; background: #d9e8ee; }
.client-map-note {
    position: absolute;
    z-index: 500;
    left: 50%;
    bottom: 14px;
    padding: 7px 11px;
    border-radius: 999px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 7px 20px rgba(20, 43, 36, .14);
    font-size: .7rem;
    font-weight: 750;
    transform: translateX(-50%);
    pointer-events: none;
}
.client-map-note i { margin-right: 6px; color: var(--brand-green); }
.leaflet-container { font-family: inherit; }
.leaflet-tooltip.neighborhood-tooltip { padding: 9px 11px; border: 0; border-radius: 10px; box-shadow: 0 10px 25px rgba(20, 43, 36, .18); }
.neighborhood-tooltip strong, .neighborhood-tooltip span { display: block; }
.neighborhood-tooltip span { color: var(--text-muted); font-size: .72rem; }
.filter-chip {
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 16px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    background: var(--white);
    color: var(--text-main);
    font-weight: 700;
    white-space: nowrap;
}
.filter-chip.active { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }

.business-grid, .product-grid {
    display: grid;
    gap: 16px;
}
.business-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.product-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.business-card, .product-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}
.business-card {
    display: block;
    width: 100%;
    min-height: 0;
    text-align: left;
    padding: 0;
    position: relative;
}
.business-card:hover, .product-card:hover { transform: translateY(-2px); transition: transform 0.18s ease; }
.business-card.closed { opacity: 0.72; filter: grayscale(0.25); }
.business-media {
    display: block;
    width: 100%;
    position: relative;
    aspect-ratio: 16 / 9;
    height: auto;
    overflow: hidden;
    background: #eef2f7;
}
.business-logo { width: 100%; height: 100%; object-fit: cover; display: block; }
.business-info { display: grid; gap: 8px; padding: 13px 14px 15px; min-width: 0; }
.business-name {
    color: var(--primary);
    font-size: 1.05rem;
    line-height: 1.15;
}
.business-info strong, .product-info strong { display: block; line-height: 1.2; margin-bottom: 6px; }
.business-category {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}
.business-info p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.35; }
.business-description { color: var(--text-main) !important; }
.business-address { display: flex; gap: 7px; align-items: flex-start; }
.business-address i { color: var(--text-muted); margin-top: 2px; }
.business-hero {
    min-height: 0;
    border-radius: 8px;
    background: var(--brand-forest);
    color: var(--white);
    margin-bottom: 14px;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px 14px;
    padding: 14px;
    overflow: hidden;
}
.hero-logo { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--white); }
.hero-copy { min-width: 0; }
.hero-copy h1 { font-size: 1.2rem; line-height: 1.15; margin-bottom: 0; }
.hero-address { display: flex; gap: 7px; align-items: flex-start; margin-top: 8px; color: #d5e8e0; font-size: .84rem; line-height: 1.35; }
.hero-address i { margin-top: 2px; color: #8be0c0; }

.menu-sticky-tools {
    position: sticky;
    top: 64px;
    z-index: 15;
    padding: 8px 0 5px;
    background: var(--white);
}
.menu-sticky-tools .menu-tools { margin-bottom: 3px; }
.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--white);
    color: var(--text-main);
    padding: 10px 14px;
    font-weight: 700;
    white-space: nowrap;
}
.cat-tab.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

.product-card {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    min-height: 142px;
    width: 100%;
}
.product-image-btn {
    width: 118px;
    height: 118px;
    align-self: start;
    border: none;
    background: #eef2f7;
    display: block;
    overflow: hidden;
}
.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.product-info { padding: 12px 14px 12px 12px; display: flex; flex-direction: column; flex: 1; min-width: 0; }
.product-info p { color: var(--text-muted); font-size: 0.86rem; margin-bottom: 12px; }
.product-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.price { font-weight: 900; color: var(--primary); white-space: nowrap; }
.add-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex: 0 0 40px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    display: grid;
    place-items: center;
}
.extra-marker { color: #7c3aed; font-size: 0.78rem; font-weight: 800; }
.allergen-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 4px 0 12px;
}
.allergen-icon {
    width: 29px;
    height: 29px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    display: inline-grid;
    place-items: center;
    overflow: hidden;
}
.allergen-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.empty-panel { text-align: center; color: var(--text-muted); padding: 64px 20px; }
.empty-panel i { font-size: 2.5rem; color: var(--accent); margin-bottom: 12px; }
.empty-panel h2 { color: var(--primary); margin-bottom: 8px; }

.cart-drawer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.cart-drawer.open { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.36); opacity: 0; transition: opacity 0.2s ease; }
.cart-drawer.open .drawer-backdrop { opacity: 1; }
.cart-panel {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    height: 100dvh;
    width: min(430px, 100%);
    background: var(--white);
    transform: translateX(100%);
    transition: transform 0.22s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}
.cart-drawer.open .cart-panel { transform: translateX(0); }
.cart-header { padding: 13px 18px; background: var(--white); color: var(--brand-ink); display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.cart-brand { display: block; flex: 0 0 auto; border: 0; padding: 0; background: transparent; }
.cart-brand img { display: block; width: 132px; max-width: 35vw; height: auto; }
.cart-heading { min-width: 0; flex: 1; }
.cart-heading strong { display: block; }
.cart-heading span { display: block; color: var(--text-muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-items { flex: 1; overflow-y: auto; padding: 14px; }
.cart-empty { text-align: center; color: var(--text-muted); padding: 42px 10px; }
.cart-line { border-bottom: 1px solid var(--border); padding: 12px 0; }
.cart-line.extra { margin-left: 18px; color: var(--text-muted); font-size: 0.9rem; }
.line-main { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.qty-tools { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty-tools button { width: 30px; height: 30px; border: none; border-radius: 8px; background: #eef2f7; color: var(--primary); font-weight: 900; }
.line-price { font-weight: 900; }
.cart-footer { border-top: 1px solid var(--border); padding: 14px; background: #f8fafc; }
.cart-footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.cart-add-more { background: var(--accent); color: var(--white); }
.total-row { display: flex; justify-content: space-between; align-items: center; font-size: 1.25rem; margin-bottom: 12px; }

.primary-btn, .secondary-btn {
    min-height: 48px;
    border-radius: 8px;
    padding: 0 16px;
    border: none;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.primary-btn { background: var(--success); color: white; width: 100%; }
.secondary-btn { background: #eef2f7; color: var(--primary); }
.primary-btn:disabled { opacity: 0.6; cursor: wait; }

.modal { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); background: rgba(15, 23, 42, 0.48); }
.modal.open { display: grid; }
.modal-card {
    width: min(520px, 100%);
    max-height: min(760px, 92vh);
    overflow: hidden;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.checkout-heading { padding: 16px; display: flex; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 1px solid var(--border); color: var(--brand-ink); }
.checkout-heading strong { display: block; font-size: 1.05rem; }
.checkout-heading span { color: var(--text-muted); font-size: 0.86rem; }
.extras-list { padding: 12px; overflow-y: auto; display: grid; gap: 10px; }
.extra-option { border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: flex; gap: 12px; align-items: center; }
.extra-option input { width: 20px; height: 20px; accent-color: var(--accent); }
.extra-option strong { flex: 1; }
.extra-option span { white-space: nowrap; }
.modal-actions { padding: 14px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.image-modal { background: rgba(15, 23, 42, 0.72); }
.image-modal-card {
    position: relative;
    width: min(680px, 94vw);
    max-height: 88vh;
    display: grid;
    place-items: center;
}
.image-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}
.image-modal-card img {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    background: var(--white);
}
.checkout-card { width: min(640px, 100%); }
.auth-view { max-width: 980px; margin: 0 auto; padding: 24px 18px 32px; }
.auth-view.active { display: block; }
.auth-view .auth-card {
    width: 100%;
    max-height: none;
    min-height: min(680px, calc(100dvh - 110px));
    display: grid;
    grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
    border: 1px solid var(--brand-line);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(13, 48, 39, 0.13);
    background: var(--white);
}
.auth-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 5vw, 52px);
    color: var(--white);
    background:
        radial-gradient(circle at 85% 12%, rgba(54, 211, 153, 0.25), transparent 34%),
        linear-gradient(145deg, var(--brand-forest), #174d3f);
}
.auth-brand-panel img {
    width: min(210px, 84%);
    margin-bottom: 34px;
    padding: 9px 12px;
    border-radius: 13px;
    background: rgba(255,255,255,0.96);
}
.auth-brand-panel > span {
    margin-bottom: 12px;
    color: #8de6c3;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.auth-brand-panel h2 { max-width: 360px; font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.05; }
.auth-brand-panel p { margin-top: 18px; color: #d8ece5; line-height: 1.55; }
.auth-brand-panel ul { display: grid; gap: 11px; margin-top: 30px; list-style: none; color: #edf9f4; font-size: 0.9rem; font-weight: 750; }
.auth-brand-panel li { display: flex; gap: 9px; align-items: center; }
.auth-brand-panel li i { color: #6ee7b7; }
.auth-panel { min-width: 0; display: flex; flex-direction: column; background: var(--white); }
.account-trigger { width: auto; min-width: 44px; max-width: 190px; gap: 7px; padding-inline: 10px; }
.account-trigger .account-name { max-width: 135px; overflow: hidden; color: var(--brand-ink); font-size: .82rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.welcome-banner {
    position: fixed;
    z-index: 80;
    top: 76px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(440px, calc(100vw - 36px));
    padding: 13px 14px 13px 17px;
    border: 1px solid #a7e3c9;
    border-radius: 14px;
    color: #145c45;
    background: #effcf6;
    box-shadow: 0 14px 32px rgba(15, 75, 55, .16);
    font-weight: 750;
}
.welcome-banner > div { display: flex; align-items: center; gap: 10px; line-height: 1.35; }
.welcome-banner > div i { color: var(--brand-green); }
.welcome-banner .icon-btn { flex: 0 0 34px; width: 34px; height: 34px; color: var(--brand-ink); }
.welcome-banner[hidden], .register-confirmation[hidden] { display: none !important; }
.auth-view .auth-form { overflow: visible; }
.checkout-view {
    max-width: 680px;
    margin: 0 auto;
    padding: 12px 16px 18px;
}
.checkout-view.active { display: block; }
.checkout-view .checkout-card {
    width: 100%;
    max-height: none;
    min-height: calc(100dvh - 24px);
    box-shadow: none;
    border: 1px solid var(--border);
}
.payment-result {
    min-height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(34px, 8vw, 68px) clamp(22px, 7vw, 56px);
    color: var(--brand-ink);
}
.payment-result-icon {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    margin-bottom: 18px;
    color: var(--white);
    background: var(--brand-green);
    box-shadow: 0 14px 28px rgba(13, 107, 82, .22);
    font-size: 1.9rem;
}
.payment-result-eyebrow {
    color: var(--brand-green);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.payment-result h2 {
    margin-top: 8px;
    color: var(--brand-forest);
    font-size: clamp(2rem, 7vw, 2.8rem);
    line-height: 1.08;
}
.payment-result-lead {
    max-width: 440px;
    margin: 15px 0 0;
    color: var(--text-main);
    font-size: clamp(1.02rem, 3.8vw, 1.22rem);
    line-height: 1.55;
}
.payment-result-next {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 460px;
    margin: 27px 0 24px;
    padding: 15px 16px;
    border: 1px solid var(--brand-line);
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    text-align: left;
    line-height: 1.45;
}
.payment-result-next i { margin-top: 3px; color: var(--brand-green); }
.payment-result-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-width: min(100%, 300px);
    padding: 0 20px;
    border: 0;
    color: var(--white);
}
.payment-result--pending .payment-result-icon { background: var(--accent); box-shadow: 0 14px 28px rgba(255, 140, 0, .2); }
.payment-result--pending .payment-result-eyebrow { color: #b45309; }
.payment-result--pending .secondary-btn { margin-top: 28px; }
.postpay-invoice-request {
    width: min(100%, 520px);
    margin: 24px 0 8px;
    padding: 18px;
    border: 1px solid rgba(13, 107, 82, .18);
    border-radius: 16px;
    background: linear-gradient(135deg, #f1fbf7, #ffffff);
    box-shadow: 0 10px 24px rgba(13, 107, 82, .08);
    text-align: left;
}
.postpay-invoice-request > p:first-child {
    margin: 0 0 12px;
    color: var(--brand-forest);
    font-weight: 800;
}
.postpay-invoice-request .checkout-billing-grid {
    margin-top: 14px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .78);
}
.postpay-invoice-request input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    background: #fff;
    color: var(--brand-ink);
}
.postpay-invoice-request input:focus {
    outline: 3px solid rgba(13, 107, 82, .14);
    border-color: var(--brand-green);
}
.postpay-invoice-request .field-hint { margin: 12px 0 0; }
.postpay-invoice-request .primary-btn,
.postpay-invoice-request .secondary-btn { margin-top: 8px; }
.payment-warning {
    margin: 12px 14px 0;
    color: #c2410c;
    font-weight: 800;
    line-height: 1.35;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 10px 12px;
}
.auth-card { width: min(940px, 100%); }
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin: 0 30px;
    padding: 5px;
    border: 1px solid var(--brand-line);
    border-radius: 14px;
    background: var(--brand-soft);
}
.auth-tab {
    min-height: 46px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--brand-ink);
    font-weight: 800;
}
.auth-tab.active { background: var(--brand-forest); color: var(--white); box-shadow: 0 6px 18px rgba(13,48,39,.18); }
.auth-form {
    display: none;
    padding: 24px 30px 30px;
    gap: 14px;
    overflow-y: auto;
}
.auth-form.active { display: grid; }
.auth-form label {
    display: grid;
    gap: 7px;
    color: var(--brand-ink);
    font-size: 0.88rem;
    font-weight: 800;
}
.auth-form input {
    width: 100%;
    min-height: 50px;
    border: 1px solid #b9cac4;
    border-radius: 11px;
    padding: 0 13px;
    outline: none;
    color: var(--brand-ink);
    background: var(--white);
    font-size: 16px;
}
.auth-form input:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(13,107,82,.14);
}
.password-control { position: relative; display: block; }
.password-control input { padding-right: 52px; }
.password-toggle {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 9px;
    color: var(--brand-green);
    background: transparent;
}
.password-toggle:hover { background: var(--brand-soft); }
.input-help { color: var(--text-muted); font-size: 0.78rem; font-weight: 600; line-height: 1.4; }
.auth-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.check-row { display: inline-flex !important; grid-auto-flow: column; justify-content: start; align-items: center; gap: 8px !important; font-weight: 700 !important; }
.check-row input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--brand-green); }
.link-btn {
    border: none;
    background: transparent;
    color: var(--brand-green);
    font-weight: 800;
    padding: 8px 0;
    text-align: left;
}
.auth-form .primary-btn { min-height: 52px; border-radius: 12px; background: var(--brand-green); }
.auth-form .primary-btn:hover { background: var(--brand-forest); }
.auth-form .secondary-btn { min-height: 50px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); }
.secondary-btn.full { width: 100%; }
#account-fiscal-form, #account-fiscal-person, #account-fiscal-company { display: grid; gap: 10px; }
#account-fiscal-form [hidden], #account-fiscal-person[hidden], #account-fiscal-company[hidden] { display: none; }
#account-fiscal-form label { display: grid; gap: 5px; }
#account-fiscal-form input:not([type="radio"]) { width: 100%; min-height: 42px; }
.fiscal-entity-choice { display: flex; flex-wrap: wrap; gap: 12px; border: 0; padding: 0; }
.fiscal-entity-choice legend { font-weight: 700; margin-bottom: 8px; }
.fiscal-entity-choice label { display: inline-flex !important; align-items: center; gap: 6px; }
.auth-session-panel {
    padding: 24px 30px 30px;
}
.account-summary {
    display: grid;
    gap: 7px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid var(--brand-line);
    border-radius: 14px;
    color: var(--brand-ink);
    background: var(--brand-soft);
}
.account-summary strong { font-size: 1.12rem; line-height: 1.3; }
.account-summary span { color: var(--text-muted); font-size: .9rem; line-height: 1.35; }
.account-active-order {
    display: grid;
    gap: 5px;
    margin: -8px 0 22px;
    padding: 16px 18px;
    border: 1px solid #b4d9cb;
    border-radius: 14px;
    color: var(--brand-ink);
    background: #e9f7f2;
}
.account-active-order[hidden] { display: none !important; }
.account-active-order-label { color: var(--brand-green); font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.account-active-order strong { font-size: 1rem; }
.account-active-order-reference { color: var(--text-muted); font-size: .82rem; }
.account-active-order-status { width: fit-content; margin-top: 4px; padding: 5px 9px; border-radius: 999px; color: var(--brand-forest); background: var(--white); font-size: .78rem; font-weight: 850; }
.register-confirmation {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 38px 30px 34px;
    color: var(--brand-ink);
    text-align: center;
}
.register-confirmation-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    color: var(--white);
    background: var(--brand-green);
    box-shadow: 0 12px 24px rgba(13, 107, 82, .22);
    font-size: 2rem;
}
.register-confirmation h2 { max-width: 510px; color: var(--brand-forest); font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.12; }
.register-confirmation p { max-width: 530px; margin: 0; line-height: 1.55; }
.register-confirmation .field-hint { width: 100%; margin: 0; text-align: left; }
.register-confirmation .secondary-btn { margin-top: 4px; }
.logout-btn {
    min-height: 56px;
    font-size: 1rem;
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand-ink);
}
.auth-copy { padding: 13px 14px; border-radius: 12px; color: var(--text-muted); background: var(--brand-soft); line-height: 1.5; }
.field-hint {
    margin-top: -4px;
    color: #c2410c;
    font-size: 0.82rem;
    line-height: 1.35;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 8px 10px;
}
.street-suggestions {
    display: grid;
    gap: 4px;
    margin-top: -8px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}
.street-suggestions[hidden] { display: none !important; }
.street-suggestion {
    width: 100%;
    border: 0;
    border-radius: 7px;
    padding: 10px;
    color: var(--text-main);
    background: transparent;
    font-size: 0.9rem;
    line-height: 1.3;
    text-align: left;
}
.street-suggestion:hover, .street-suggestion:focus { background: var(--brand-soft); outline: none; }
.social-auth {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.social-auth .g_id_signin, .social-auth .g_id_signin > div, .social-auth iframe { width: 100% !important; max-width: 100% !important; }
#register-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#register-form .social-auth, #register-form .field-hint, #register-form .register-wide-field, #register-form .password-label, #register-form .primary-btn, #register-form .secondary-btn { grid-column: 1 / -1; }
.checkout-mode {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.checkout-auth-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    background: var(--white);
}
.checkout-order-customer { margin: 0 0 8px; color: var(--brand-ink); font-size: 1rem; font-weight: 850; }
.checkout-google-slot {
    min-width: 0;
    display: grid;
    align-items: center;
}
.checkout-google-slot .g_id_signin {
    width: 100%;
}
.checkout-auth-account {
    min-height: 50px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    font-weight: 900;
    min-width: 0;
}
.checkout-auth-account span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.checkout-auth-account i { color: var(--success); }
.checkout-auth-btn {
    min-height: 50px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    font-weight: 900;
    min-width: 0;
}
.checkout-auth-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.checkout-auth-btn i { color: var(--accent); }
.checkout-auth-btn[hidden], #customer-street-field[hidden] { display: none !important; }
#btn-submit-order { background: var(--brand-forest); border-color: var(--brand-forest); }
#btn-submit-order:hover { background: var(--brand-green); border-color: var(--brand-green); }
.checkout-auth-btn.secondary {
    background: #eef2f7;
}
.mode-toggle {
    min-height: 58px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-main);
    display: grid;
    place-items: center;
    gap: 5px;
    padding: 8px;
    font-weight: 900;
}
.mode-toggle i { color: var(--accent); }
.mode-toggle span { font-size: 0.82rem; text-align: center; }
.mode-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}
.mode-toggle.active i { color: var(--white); }
.form-grid { padding: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; overflow-y: auto; }
.form-grid label { display: grid; gap: 6px; color: var(--text-muted); font-size: 0.86rem; font-weight: 800; }
.form-grid input { height: 46px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; outline: none; color: var(--text-main); }
.form-grid input[aria-invalid="true"] { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }
.form-grid label:nth-child(4), .wide-field { grid-column: 1 / -1; }
.checkout-email-hint { grid-column: 1 / -1; }
.checkout-billing-toggle { margin-top: 4px; color: var(--brand-ink) !important; }
.checkout-billing-fields {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    background: #f8fafc;
}
.checkout-billing-fields[hidden] { display: none !important; }
.checkout-billing-copy {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.45;
}
.checkout-billing-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.checkout-billing-grid label { display: grid; gap: 6px; }
.checkout-field-error {
    margin: -6px 0 0;
    grid-column: auto;
}
.checkout-billing-summary-error { margin: 0; }

.toast-container { position: fixed; top: 86px; right: 16px; z-index: 70; display: grid; gap: 10px; width: min(360px, calc(100% - 32px)); }
.toast { background: var(--primary); color: white; border-radius: 8px; padding: 14px 16px; box-shadow: var(--shadow); animation: toastIn 0.22s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 720px) {
    .app-header { min-height: 60px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; }
    .header-logo-btn { height: 42px; max-width: calc(100vw - 122px); }
    .header-logo-btn img { max-height: 42px; }
    .header-actions { gap: 8px; }
    .app-shell { padding: 12px; }
    .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 52px; }
    .view-businesses > .toolbar { top: 60px; }
    .client-map-panel, #cliente-huelva-map { min-height: 420px; }
    .client-map-toolbar > div:not(.client-map-actions) { display: none; }
    .client-map-toolbar { justify-content: flex-end; }
    .menu-sticky-tools { top: 60px; margin-inline: -12px; padding-inline: 12px; }
    .menu-tools { display: block; margin-bottom: 4px; }
    .search-box.compact { max-width: none; }
    .business-grid, .product-grid { grid-template-columns: 1fr; }
    .business-hero { grid-template-columns: 68px minmax(0, 1fr); padding: 12px; }
    .hero-logo { width: 68px; height: 68px; }
    .hero-copy h1 { font-size: 1.15rem; }
    .category-tabs { margin-inline: 0; padding-inline: 0; }
    .product-card { grid-template-columns: 104px minmax(0, 1fr); min-height: 128px; }
    .product-image-btn { width: 104px; height: 104px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid label:nth-child(4), .wide-field { grid-column: auto; }
    .checkout-billing-grid { grid-template-columns: 1fr; }
    .checkout-field-error { grid-column: auto; }
    .social-auth, .checkout-mode { grid-template-columns: 1fr; }
    .checkout-auth-actions { grid-template-columns: 1fr; padding: 12px; }
    .auth-view { padding: 0 0 max(18px, env(safe-area-inset-bottom)); }
    .auth-view .auth-card {
        min-height: calc(100dvh - 60px);
        display: block;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .auth-brand-panel { display: none; }
    .auth-panel { min-height: calc(100dvh - 60px); }
    .auth-view .modal-header { padding: 19px 14px 13px; }
    .auth-view .auth-tabs { margin: 0 12px; padding: 4px; }
    .auth-view .auth-form { padding: 18px 12px 24px; }
    .auth-view .social-auth { grid-template-columns: 1fr; }
    .auth-session-panel { padding: 18px 12px 24px; }
    #register-form { grid-template-columns: 1fr; }
    #register-form > * { grid-column: auto !important; }
    .checkout-view { padding: 0; }
    .checkout-view .checkout-card { border: none; border-radius: 0; min-height: 100dvh; }
    #extras-modal .modal-card { width: min(360px, calc(100vw - 24px)); max-height: 86vh; }
    #extras-modal .modal-header { padding: 14px 12px; }
    #extras-modal .modal-header strong { font-size: 1.1rem; line-height: 1.25; }
    #extras-modal .extras-list { padding: 12px; }
    #extras-modal .extra-option { align-items: center; gap: 10px; padding: 12px; }
    #extras-modal .modal-actions { padding: 12px; gap: 8px; }
    #extras-modal .primary-btn, #extras-modal .secondary-btn { min-height: 64px; padding: 0 10px; white-space: normal; line-height: 1.15; }
}

@media (max-width: 430px) {
    .business-grid { gap: 14px; }
    .business-name { font-size: 1rem; }
    .product-card { min-height: 122px; }
    .product-card { grid-template-columns: 92px minmax(0, 1fr); }
    .product-image-btn { width: 92px; height: 92px; }
    .product-info { padding: 10px 12px 10px 10px; }
    .product-info strong { font-size: 0.95rem; }
    .product-info p { font-size: 0.8rem; margin-bottom: 8px; }
    .add-btn { width: 38px; height: 38px; min-width: 38px; min-height: 38px; flex-basis: 38px; }
    .auth-header strong { font-size: 1.34rem; }
    .auth-header span { font-size: 0.82rem; }
    .auth-tab { min-height: 44px; }
    .auth-form { gap: 12px; }
}

@media (max-width: 340px) {
    .app-header { padding-inline: 8px; }
    .header-actions { gap: 6px; }
    .auth-view .modal-header { padding-inline: 10px; }
    .auth-view .auth-tabs { margin-inline: 8px; }
    .auth-view .auth-form, .auth-session-panel { padding-inline: 8px; }
    .auth-row { align-items: flex-start; flex-direction: column; }
}

@media (max-height: 580px) and (orientation: landscape) {
    .auth-view .auth-card, .auth-panel { min-height: 0; }
    .auth-brand-panel { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-tab, .auth-form .primary-btn, .password-toggle { transition: none; }
}

@media (max-width: 480px) {
    .account-trigger { max-width: 145px; }
    .account-trigger .account-name { max-width: 92px; font-size: .78rem; }
    .welcome-banner { top: 64px; right: 10px; max-width: calc(100vw - 20px); }
    .client-map-panel, #cliente-huelva-map { min-height: 360px; }
    .client-map-note { bottom: 10px; font-size: .64rem; white-space: nowrap; }
    .business-media {
        height: calc((100vw - 24px) * 0.5625);
        aspect-ratio: auto;
    }
}
