*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg-page: #0b141a;
    --bg-shell: #111b21;
    --bg-main: #0b141a;
    --bg-main-soft: #111b21;
    --bg-card: #202c33;
    --bg-card-strong: #202c33;
    --bg-user: #005c4b;
    --bg-assistant: #202c33;
    --bg-header: #111b21;
    --bg-footer: #111b21;
    --bg-input: #202c33;
    --bg-cart: #111b21;
    --bg-cart-body: #0b141a;
    --bg-overlay: rgba(0, 0, 0, 0.45);

    --text-main: #e9edef;
    --text-soft: #c7d0d4;
    --text-muted: #8696a0;
    --text-white: #ffffff;

    --border-soft: rgba(134, 150, 160, 0.16);
    --border-strong: rgba(134, 150, 160, 0.22);

    --accent: #00a884;
    --accent-hover: #019270;
    --accent-soft: rgba(0, 168, 132, 0.14);

    --success: #25d366;
    --success-soft: rgba(37, 211, 102, 0.14);

    --danger: #f15c6d;
    --danger-soft: rgba(241, 92, 109, 0.14);

    --shadow-xs: 0 2px 10px rgba(0, 0, 0, 0.18);
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.34);
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg-page);
    color: var(--text-main);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    overflow: hidden;
}

body,
button,
input,
textarea,
select {
    font: inherit;
}

button,
input,
textarea,
select {
    outline: none;
}

a {
    color: inherit;
    text-decoration: none;
}

.chat-page {
    position: relative;
    height: 100dvh;
    width: 100%;
    display: flex;
    justify-content: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.02), transparent 18%),
        radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.02), transparent 20%),
        radial-gradient(circle at 30% 80%, rgba(255, 255, 255, 0.018), transparent 18%),
        linear-gradient(180deg, #0b141a 0%, #0f1a20 100%);
}

.chat-shell {
    width: min(920px, 100%);
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--bg-shell);
    box-shadow: var(--shadow-md);
    border-left: 1px solid rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.chat-header {
    background: var(--bg-header);
    color: var(--text-white);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: var(--shadow-sm);
    z-index: 20;
}

.chat-header-main {
    min-height: 78px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.chat-header-left {
    min-width: 0;
}

.chat-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-bot-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    background: rgba(0, 168, 132, 0.14);
    border: 1px solid rgba(0, 168, 132, 0.28);
    color: #7cf0d3;
}

.chat-title-texts h1 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.chat-title-texts p {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.chat-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.header-action-btn {
    min-height: 42px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: #202c33;
    color: var(--text-main);
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.header-action-btn:hover {
    background: #233138;
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

.header-action-cart {
    background: rgba(0, 168, 132, 0.16);
    border-color: rgba(0, 168, 132, 0.28);
    color: #dffaf4;
}

.header-action-cart:hover {
    background: rgba(0, 168, 132, 0.22);
}

.header-action-icon {
    font-size: 0.92rem;
    line-height: 1;
}

.header-action-label {
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.header-action-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--success);
    color: #08251d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
}

.header-action-count[hidden] {
    display: none !important;
}

.chat-main {
    min-height: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 25% 15%, rgba(255, 255, 255, 0.015), transparent 18%),
        radial-gradient(circle at 70% 35%, rgba(255, 255, 255, 0.014), transparent 16%),
        radial-gradient(circle at 45% 80%, rgba(255, 255, 255, 0.012), transparent 18%),
        var(--bg-main);
}

.chat-messages {
    height: 100%;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar,
.cart-body::-webkit-scrollbar,
.checkout-modal-content::-webkit-scrollbar,
#messageInput::-webkit-scrollbar,
.product-carousel-track::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.chat-messages::-webkit-scrollbar-thumb,
.cart-body::-webkit-scrollbar-thumb,
.checkout-modal-content::-webkit-scrollbar-thumb,
#messageInput::-webkit-scrollbar-thumb,
.product-carousel-track::-webkit-scrollbar-thumb {
    background: rgba(134, 150, 160, 0.28);
    border-radius: 999px;
}

.chat-messages::-webkit-scrollbar-track,
.cart-body::-webkit-scrollbar-track,
.checkout-modal-content::-webkit-scrollbar-track,
#messageInput::-webkit-scrollbar-track,
.product-carousel-track::-webkit-scrollbar-track {
    background: transparent;
}

.message,
.product-list,
.product-carousel-section {
    animation: fadeInUp 0.18s ease;
}

.message {
    width: 100%;
    display: flex;
}

.message.assistant {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(92%, 700px);
    padding: 13px 15px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.96rem;
    box-shadow: var(--shadow-xs);
    white-space: pre-wrap;
    word-break: break-word;
}

.message.assistant .message-bubble {
    background: var(--bg-assistant);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px 12px 12px 4px;
}

.message.user .message-bubble {
    background: var(--bg-user);
    color: var(--text-white);
    border: 1px solid rgba(0, 168, 132, 0.18);
    border-radius: 12px 12px 4px 12px;
}

.message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-inline-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-open-cart-btn {
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    background: var(--accent);
    color: #052d24;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 8px 18px rgba(0, 168, 132, 0.22);
}

.chat-open-cart-btn:hover {
    transform: translateY(-1px);
    background: var(--accent-hover);
    color: #ffffff;
}

.product-list {
    width: 100%;
    display: grid;
    gap: 14px;
    align-self: flex-start;
}

.product-card {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-xs);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: rgba(0, 168, 132, 0.18);
}

.product-image {
    width: 86px;
    height: 86px;
    object-fit: cover;
    border-radius: 14px;
    display: block;
    background: #1a252c;
}

.product-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    color: var(--accent);
}

.product-card-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-name {
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-main);
}

.product-description {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.product-card-footer {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.product-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--success);
    white-space: nowrap;
}

.add-to-cart-btn {
    min-width: 104px;
    height: 38px;
    border: none;
    border-radius: 999px;
    padding: 0 14px;
    background: var(--accent);
    color: #052d24;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 8px 18px rgba(0, 168, 132, 0.22);
}

.add-to-cart-btn:hover {
    transform: translateY(-1px);
    background: var(--accent-hover);
    color: #ffffff;
}

.product-carousel-section {
    width: 100%;
    display: grid;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(17, 27, 33, 0.92) 0%, rgba(32, 44, 51, 0.98) 100%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-xs);
    align-self: flex-start;
}

.product-carousel-header {
    display: grid;
    gap: 6px;
}

.product-carousel-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

.product-carousel-meta {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-soft);
}

.product-carousel-shell {
    position: relative;
    min-width: 0;
}

.product-carousel-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 192px;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0 6px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.product-carousel-track .product-card {
    width: 192px;
    min-width: 192px;
    max-width: 192px;
    height: 100%;
    min-height: 100%;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
    padding: 11px;
    scroll-snap-align: start;
}

.product-carousel-track .product-card:hover {
    transform: translateY(-1px);
}

.product-carousel-track .product-image,
.product-carousel-track .product-image-placeholder {
    width: 100%;
    height: 106px;
    border-radius: 12px;
}

.product-carousel-track .product-image-placeholder {
    font-size: 1.4rem;
}

.product-carousel-track .product-card-body {
    gap: 5px;
}

.product-carousel-track .product-name {
    font-size: 0.88rem;
    line-height: 1.28;
}

.product-carousel-track .product-description {
    font-size: 0.76rem;
    line-height: 1.35;
}

.product-carousel-track .product-card-footer {
    margin-top: 8px;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
}

.product-carousel-track .product-price {
    font-size: 0.9rem;
}

.product-carousel-track .add-to-cart-btn {
    width: 100%;
    min-width: 0;
    height: 35px;
    font-size: 0.79rem;
    padding: 0 10px;
}

.product-carousel-hint {
    font-size: 0.8rem;
    line-height: 1.45;
}

.product-carousel-hint-highlight {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(0, 168, 132, 0.16) 0%, rgba(0, 168, 132, 0.08) 100%);
    border: 1px solid rgba(0, 168, 132, 0.22);
    color: #bff6ea;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 10px 24px rgba(0, 168, 132, 0.12);
    letter-spacing: 0.01em;
}

.product-carousel-hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(0, 168, 132, 0.18);
    color: #dffaf4;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.product-carousel-hint-text {
    display: inline-block;
}

.chat-footer {
    background: var(--bg-footer);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    z-index: 20;
}

.chat-form {
    display: block;
    position: relative;
}

.voice-record-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translate(-50%, 8px);
    width: min(560px, calc(100% - 20px));
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(17, 27, 33, 0.96);
    border: 1px solid rgba(0, 168, 132, 0.24);
    color: #dffaf4;
    box-shadow: var(--shadow-md);
    font-size: 0.88rem;
    line-height: 1.45;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 6;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.voice-record-tip.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.voice-record-tip[hidden] {
    display: block !important;
    opacity: 0;
    visibility: hidden;
}

.voice-record-tip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid rgba(17, 27, 33, 0.96);
}

.voice-record-tip-text {
    max-width: 100%;
}

.chat-form label {
    display: none;
}

.chat-form-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

#messageInput {
    flex: 1;
    min-height: 52px;
    max-height: 132px;
    resize: none;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 28px;
    background: var(--bg-input);
    color: var(--text-main);
    line-height: 1.42;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

#messageInput:focus {
    border-color: rgba(0, 168, 132, 0.28);
    box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.12);
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.chat-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.chat-action-btn {
    min-width: 118px;
    height: 52px;
    border-radius: 28px;
    padding: 0 18px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.chat-action-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.chat-action-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    line-height: 1;
    font-size: 0;
    color: transparent;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-action-icon::before {
    content: "";
    display: block;
    width: 22px;
    height: 22px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

#btnVoiceRecord .chat-action-icon::before {
    background-image: url("../img/chat/img_microfone.png");
}

#btnSendMessage .chat-action-icon::before {
    background-image: url("../img/chat/img_send.png");
}

.chat-action-text {
    white-space: nowrap;
}

.chat-action-send {
    border: none;
    background: var(--accent);
    color: #052d24;
    box-shadow: 0 10px 22px rgba(0, 168, 132, 0.22);
}

.chat-action-send:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--accent-hover);
    color: #ffffff;
}

.chat-action-voice {
    min-width: 104px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #202c33;
    color: var(--text-main);
    box-shadow: none;
}

.chat-action-voice:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #25343c;
    border-color: rgba(255, 255, 255, 0.14);
}

.chat-action-voice.is-recording {
    background: rgba(241, 92, 109, 0.18);
    border-color: rgba(241, 92, 109, 0.38);
    color: #ffd9de;
    box-shadow: 0 10px 22px rgba(241, 92, 109, 0.16);
}

.chat-action-voice.is-processing {
    background: rgba(0, 168, 132, 0.14);
    border-color: rgba(0, 168, 132, 0.28);
    color: #dffaf4;
    box-shadow: 0 10px 22px rgba(0, 168, 132, 0.16);
}

.voice-composer-status {
    display: none !important;
    margin-top: 10px;
    padding: 10px 14px;
    align-items: center;
    gap: 10px;
    border-radius: 14px;
    background: rgba(0, 168, 132, 0.08);
    border: 1px solid rgba(0, 168, 132, 0.14);
    color: #bff6ea;
    font-size: 0.88rem;
    line-height: 1.45;
}

.voice-composer-status[hidden] {
    display: none !important;
}

.voice-composer-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(0, 168, 132, 0.16);
    flex-shrink: 0;
}

.voice-composer-status-text {
    min-width: 0;
}

.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: var(--bg-overlay);
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

body.cart-open .cart-drawer-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.chat-cart {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: min(400px, calc(100vw - 24px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    background: var(--bg-cart);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-lg);
    transform: translateX(calc(100% + 28px));
    transition: transform 0.24s ease;
    z-index: 80;
}

body.cart-open .chat-cart {
    transform: translateX(0);
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    background: #111b21;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cart-header-info h2 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
}

.cart-header-info p {
    margin: 4px 0 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.cart-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #202c33;
    color: var(--text-main);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.cart-close-btn:hover {
    background: #25343c;
    transform: scale(1.04);
}

.cart-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background: var(--bg-cart-body);
}

.cart-empty {
    margin: 0;
    padding: 22px 16px;
    text-align: center;
    color: var(--text-muted);
    background: #202c33;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.06);
}

.cart-item {
    background: #202c33;
    border-radius: 16px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-xs);
}

.cart-item + .cart-item {
    margin-top: 10px;
}

.cart-item-highlight {
    border-color: rgba(0, 168, 132, 0.24);
    box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.08), 0 10px 24px rgba(0, 168, 132, 0.16);
    animation: cartItemFlash 1.4s ease;
}

.cart-item-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.cart-item-info {
    min-width: 0;
    flex: 1;
}

.cart-item-name {
    font-size: 0.95rem;
    line-height: 1.34;
    color: var(--text-main);
}

.cart-item-unit-price {
    margin-top: 4px;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.cart-remove-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 1.08rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.cart-remove-btn:hover {
    background: rgba(241, 92, 109, 0.2);
    transform: scale(1.04);
}

.cart-item-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    background: rgba(0, 168, 132, 0.08);
    border: 1px solid rgba(0, 168, 132, 0.12);
    border-radius: 999px;
    padding: 4px;
}

.cart-qty-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #17242b;
    color: var(--accent);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.cart-qty-btn:hover {
    background: #1c2d35;
    transform: translateY(-1px);
}

.cart-item-qty {
    min-width: 22px;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-main);
}

.cart-item-subtotal {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--success);
}

.cart-footer {
    display: grid;
    gap: 12px;
    padding: 18px;
    background: #111b21;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-subtotal-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-main);
}

#cartSubtotal {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--success);
}

.cart-footer-actions {
    display: grid;
    gap: 10px;
}

.btn-cart-secondary,
.btn-checkout {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    font-size: 0.94rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn-cart-secondary {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #202c33;
    color: var(--text-main);
}

.btn-cart-secondary:hover {
    background: #25343c;
    transform: translateY(-1px);
}

.btn-checkout {
    border: none;
    background: var(--accent);
    color: #052d24;
    box-shadow: 0 10px 22px rgba(0, 168, 132, 0.22);
}

.btn-checkout:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--accent-hover);
    color: #ffffff;
}

.btn-checkout:disabled {
    background: #33434b;
    color: #8696a0;
    cursor: not-allowed;
    box-shadow: none;
}

.order-success-bubble {
    background: #202c33 !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: min(92%, 700px);
}

.order-success-title {
    margin-bottom: 8px;
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--success);
}

.order-success-text {
    margin-top: 6px;
    color: var(--text-soft);
    line-height: 1.5;
}

.order-success-number {
    margin-top: 14px;
    font-weight: 800;
    color: var(--text-main);
}

.order-success-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.order-track-button,
.order-whatsapp-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 12px;
    text-decoration: none !important;
    font-weight: 700;
    padding: 10px 14px;
    text-align: center;
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.order-track-button {
    background: var(--accent);
    color: #052d24 !important;
}

.order-whatsapp-button {
    background: var(--success);
    color: #052d24 !important;
}

.order-track-button:hover,
.order-whatsapp-button:hover {
    transform: translateY(-1px);
    color: #ffffff !important;
}

.checkout-modal[hidden] {
    display: none !important;
}

.checkout-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.checkout-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
}

.checkout-modal-content {
    position: relative;
    width: min(720px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    margin: 12px auto;
    background: #111b21;
    color: var(--text-main);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-lg);
}

.checkout-modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    background: #111b21;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.checkout-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.checkout-close-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #202c33;
    color: var(--text-main);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.checkout-close-btn:hover {
    background: #25343c;
    transform: scale(1.04);
}

.checkout-form {
    padding: 20px;
    display: grid;
    gap: 16px;
}

.checkout-field label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
}

.checkout-field input[type="text"],
.checkout-field input[type="password"],
.checkout-field textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    background: #202c33;
    color: var(--text-main);
    padding: 13px 14px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.checkout-field textarea {
    resize: vertical;
    min-height: 110px;
}

.checkout-field input[type="text"]:focus,
.checkout-field input[type="password"]:focus,
.checkout-field textarea:focus {
    border-color: rgba(0, 168, 132, 0.28);
    box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.12);
}

.checkout-field input:disabled,
.checkout-field textarea:disabled {
    background: #17242b;
    color: #6f7f88;
    cursor: not-allowed;
    opacity: 1;
}

.checkbox-label {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.4;
    font-weight: 600 !important;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent);
}

.checkout-auth-notice {
    padding: 13px 14px;
    border-radius: 12px;
    background: rgba(0, 168, 132, 0.08);
    border: 1px solid rgba(0, 168, 132, 0.12);
    color: #8de6d3;
    line-height: 1.5;
    font-size: 0.94rem;
}

.checkout-auth-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-auth-client {
    min-height: 44px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: #052d24;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 10px 22px rgba(0, 168, 132, 0.22);
}

.btn-auth-client:hover {
    transform: translateY(-1px);
    background: var(--accent-hover);
    color: #ffffff;
}

#checkoutAuthenticatedActions a,
#btnCheckoutLogout {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    color: #7cf0d3;
    font-weight: 700;
    text-decoration: none;
}

#checkoutAuthenticatedActions a:hover,
#btnCheckoutLogout:hover {
    text-decoration: underline;
}

.checkout-summary {
    padding: 16px 18px;
    border-radius: 14px;
    background: #202c33;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.checkout-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
}

#checkoutSubtotal {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--success);
}

.checkout-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-checkout-secondary,
.btn-checkout-primary {
    min-width: 150px;
    min-height: 48px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn-checkout-secondary {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #202c33;
    color: var(--text-main);
}

.btn-checkout-secondary:hover {
    background: #25343c;
    transform: translateY(-1px);
}

.btn-checkout-primary {
    border: none;
    background: var(--accent);
    color: #052d24;
    box-shadow: 0 10px 22px rgba(0, 168, 132, 0.22);
}

.btn-checkout-primary:hover {
    transform: translateY(-1px);
    background: var(--accent-hover);
    color: #ffffff;
}

.btn-checkout-primary:disabled,
.btn-auth-client:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@keyframes cartItemFlash {
    0% {
        background: rgba(0, 168, 132, 0.12);
        transform: scale(0.99);
    }
    35% {
        background: #202c33;
        transform: scale(1);
    }
    100% {
        background: #202c33;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 860px) {
    .chat-header-main {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-header-right {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .header-action-btn {
        min-width: 0;
    }

    .header-action-label {
        font-size: 0.78rem;
    }

    .chat-messages {
        padding: 14px 12px;
    }

    .message-bubble {
        max-width: 94%;
    }

    .chat-cart {
        top: 8px;
        right: 8px;
        left: 8px;
        bottom: 8px;
        width: auto;
    }

    .checkout-modal-content {
        width: calc(100vw - 12px);
        max-height: calc(100vh - 12px);
        margin: 6px auto;
    }

    .product-carousel-track {
        grid-auto-columns: 184px;
        gap: 10px;
    }

    .product-carousel-track .product-card {
        width: 184px;
        min-width: 184px;
        max-width: 184px;
    }

    .product-carousel-track .product-image,
    .product-carousel-track .product-image-placeholder {
        height: 102px;
    }
}

@media (max-width: 560px) {
    .chat-title-texts h1 {
        font-size: 1.08rem;
    }

    .chat-title-texts p {
        font-size: 0.82rem;
    }

    .chat-form-row {
        gap: 8px;
        align-items: center;
    }

    .voice-record-tip {
        width: calc(100% - 8px);
        bottom: calc(100% + 8px);
        padding: 11px 12px;
        border-radius: 14px;
        font-size: 0.8rem;
        line-height: 1.4;
    }

    #messageInput {
        min-height: 52px;
        height: 52px;
        padding: 14px 16px;
    }

    .chat-actions {
        gap: 8px;
        align-items: center;
    }

    .chat-action-btn {
        min-width: 118px;
        height: 52px;
        padding: 0 18px;
    }

    .chat-action-voice {
        min-width: 104px;
        width: auto;
        padding: 0 18px;
    }

    .chat-action-voice .chat-action-text {
        display: inline;
    }

    .chat-action-send {
        min-width: 118px;
    }

    .product-card {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 10px;
    }

    .product-image {
        width: 72px;
        height: 72px;
    }

    .product-card-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .add-to-cart-btn {
        width: 100%;
    }

    .product-carousel-section {
        padding: 12px;
    }

    .product-carousel-track {
        grid-auto-columns: 224px;
        gap: 9px;
    }

    .product-carousel-track .product-card {
        width: 224px;
        min-width: 224px;
        max-width: 224px;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .product-carousel-track .product-image,
    .product-carousel-track .product-image-placeholder {
        width: 100%;
        height: 124px;
    }

    .product-carousel-track .product-name {
        font-size: 0.9rem;
    }

    .product-carousel-track .product-description {
        font-size: 0.78rem;
    }

    .product-carousel-track .product-price {
        font-size: 0.9rem;
    }

    .product-carousel-track .add-to-cart-btn {
        height: 36px;
        font-size: 0.8rem;
    }

    .product-carousel-hint-highlight {
        display: block;
        padding: 16px 14px;
        font-size: 0.84rem;
        text-align: center;
    }

    .product-carousel-hint-icon {
        display: none;
    }

    .product-carousel-hint-text {
        display: block;
        width: 100%;
        text-align: center;
        line-height: 1.45;
    }

    .checkout-actions {
        flex-direction: column-reverse;
    }

    .btn-checkout-secondary,
    .btn-checkout-primary {
        width: 100%;
    }

    .message-inline-actions {
        width: 100%;
    }

    .chat-open-cart-btn {
        width: 100%;
    }
}