* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: radial-gradient(circle at 10% -10%, #dae1ff 0%, #eef2ff 40%, #f6f7fb 100%); color: var(--tg-theme-text-color, #1a1a1a); }
.cartex-root { max-width: 860px; margin: 0 auto; padding: 16px; }
.cartex-app { display: grid; gap: 10px; }
.shop-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.cart-view { padding-bottom: 110px; }
.cart-view-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
h1 { font-size: 24px; margin: 0; }
h2 { margin: 0 0 12px; }
.categories { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.category-btn { padding:8px 14px; border-radius:16px; border:1px solid #b8bec8; background:#fff; cursor:pointer; }
.category-btn.active { background: var(--tg-theme-button-color, #3390ec); color: var(--tg-theme-button-text-color, #fff); border-color: transparent; }
.products { display:grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.product-card { border:1px solid #dfe5f3; border-radius:14px; padding:10px; background:#fff; box-shadow:0 8px 24px rgba(74, 92, 151, .08); }
.product-image { width:100%; height:120px; object-fit:cover; border-radius:6px; background:#e5e8ed; }
.product-name { font-weight:600; margin:8px 0 4px; }
.product-price { margin-bottom:8px; font-weight:700; }

.product-card.is-unavailable { opacity: .8; }
.product-meta-badge { display:inline-block; font-size:12px; font-weight:700; color:#995200; background:#fff4e5; border:1px solid #ffd6a8; border-radius:999px; padding:2px 8px; margin-bottom:6px; }
.add-to-cart-btn:disabled { opacity:.65; cursor:not-allowed; }
.qty-stepper.is-disabled { opacity:.6; }
.qty-stepper.is-disabled button { cursor:not-allowed; }
.add-to-cart-btn, .cart-link-btn, .back-btn, .checkout-btn, .back-link-btn { border:none; border-radius:10px; padding:8px 12px; background:linear-gradient(135deg, #5a6ff0, #3f57e7); color:var(--tg-theme-button-text-color, #fff); cursor:pointer; }
.cart-link-btn { background: transparent; color: var(--tg-theme-button-color, #3390ec); font-weight: 700; }
.back-link-btn { background: transparent; color: var(--tg-theme-button-color, #3390ec); font-weight: 600; }
.back-btn { margin-top: 12px; }
.qty-stepper { display:flex; align-items:center; gap:8px; border:1px solid #c5cad3; border-radius:8px; width:max-content; padding:2px 4px; }
.qty-stepper button { border:none; border-radius:4px; width:28px; height:28px; background:var(--tg-theme-button-color, #3390ec); color:var(--tg-theme-button-text-color, #fff); cursor:pointer; }
.cart-item { display:flex; gap:10px; align-items:flex-start; padding:10px 0; border-bottom:1px solid #e2e5ea; }
.cart-item-image { width:72px; height:72px; object-fit:cover; border-radius:8px; background:#e5e8ed; flex-shrink:0; }
.cart-item-content { flex:1; min-width:0; }
.cart-item-head { display:flex; justify-content:space-between; gap:8px; align-items:flex-start; }
.cart-item-name { font-weight:700; }
.remove-item-btn { border:none; background:none; color:#8c94a2; padding:0; cursor:pointer; }
.cart-item-pricing { display:flex; justify-content:space-between; margin:6px 0 8px; color:#535c69; }
.cart-empty-state { text-align:center; border:1px dashed #d2d8e1; border-radius:10px; padding:20px 12px; }
.cart-totals { margin-top:12px; border-top:1px solid #e2e5ea; padding-top:10px; }
.cart-total-row { display:flex; justify-content:space-between; padding:4px 0; }
.cart-total-row.discount { color:#2d8f4e; }
.cart-total-row.final { font-size:18px; font-weight:700; margin-top:4px; }
.cart-footer { position:fixed; left:0; right:0; bottom:0; background:#fff; border-top:1px solid #e2e5ea; padding:10px 16px calc(10px + env(safe-area-inset-bottom)); display:flex; justify-content:space-between; align-items:center; gap:12px; max-width:860px; margin:0 auto; }
.cart-footer-total { display:flex; flex-direction:column; font-size:14px; color:#727b89; }
.cart-footer-total strong { font-size:18px; color:#1a1a1a; }
.checkout-btn { min-width:170px; font-weight:700; }
.checkout-btn:disabled { opacity:.55; cursor:not-allowed; }
.cart-footer.is-disabled { opacity:.9; }
.loading { text-align:center; padding:28px; color:#7f8794; }
.product-modal { position:fixed; inset:0; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; padding:12px; }
.product-modal[hidden] { display:none; }
.product-modal-content { width:100%; max-width:420px; background:#fff; border-radius:12px; padding:12px; }
.modal-product-image { width:100%; max-height:240px; object-fit:cover; border-radius:8px; margin-bottom:8px; }
.modal-product-name { font-size:20px; font-weight:700; margin-bottom:6px; }
.modal-product-description { color:#636b77; margin-bottom:6px; }
.modal-product-price { font-size:22px; font-weight:700; margin-bottom:8px; }
.modal-actions { display:flex; gap:8px; align-items:center; margin-top:10px; }

.checkout-view,
.confirmation-view { max-width: 560px; }

.checkout-form { display: grid; gap: 12px; }
.field-label { display: grid; gap: 6px; font-weight: 600; color: #293241; }
.field-label input,
.field-label textarea { border: 1px solid #ccd2dc; border-radius: 10px; padding: 10px; font: inherit; background:#fff; }
.checkout-summary { margin-top: 8px; border-top: 1px solid #e2e5ea; padding-top: 8px; }
.loyalty-points-block { border:1px solid #d8e2f5; background:#f6f9ff; border-radius:8px; padding:8px 10px; margin:6px 0; font-size:14px; }
.loyalty-points-block.error { border-color:#f1b4b8; background:#fff1f2; color:#a72a35; }
.loyalty-points-title { font-weight:700; margin-bottom:6px; }
.loyalty-points-row { display:flex; justify-content:space-between; padding:2px 0; }
.checkout-error { border: 1px solid #f1b4b8; background: #fff1f2; color: #a72a35; border-radius: 8px; padding: 10px; }
.checkout-submit { width: 100%; padding: 12px; }
.confirmation-details { border: 1px solid #e2e5ea; border-radius: 10px; padding: 10px; margin: 10px 0 14px; background: #fff; }

.header-links { display:flex; gap:10px; align-items:center; }
.orders-view,
.order-status-view { max-width: 680px; }
.orders-empty-state { border:1px dashed #d2d8e1; border-radius:10px; padding:18px 12px; text-align:center; }
.order-card { width:100%; text-align:left; border:1px solid #e2e5ea; background:#fff; border-radius:10px; padding:12px; margin-bottom:10px; cursor:pointer; }
.order-card-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:4px; }
.order-card-meta { color:#6b7381; margin-bottom:6px; }
.order-card-preview { color:#444d5a; font-size:14px; }
.order-status-chip { border-radius:999px; background:#edf4ff; color:#2c66c5; padding:2px 10px; font-size:12px; font-weight:700; }
.order-status-card { border:1px solid #e2e5ea; border-radius:12px; padding:12px; background:#fff; }
.order-timeline { display:grid; gap:8px; margin:12px 0; }
.timeline-step { border:1px solid #d9dee7; border-radius:8px; padding:8px 10px; color:#6f7786; }
.timeline-step.done { border-color:#3c8c4a; color:#206f30; background:#eef8f0; font-weight:600; }
.order-items { margin-top:10px; border-top:1px solid #e2e5ea; padding-top:8px; }
.order-item-row { display:flex; justify-content:space-between; gap:10px; padding:4px 0; }
.order-status-actions,
.confirmation-actions { display:flex; gap:10px; margin-top:12px; }


.delivery-address-block { border: 1px solid #e2e5ea; border-radius: 10px; padding: 10px; background: #fff; display: grid; gap: 10px; }

.map-picker-head { font-weight:600; color:#253041; }
.checkout-map { width:100%; height:220px; border:1px solid #d7dce5; border-radius:10px; overflow:hidden; background:#f4f6fa; }
.map-picker-hint { font-size:13px; color:#6d7584; }
.map-selected-address { font-size:14px; color:#253041; background:#f4f7ff; border:1px solid #d9e4ff; border-radius:8px; padding:8px 10px; }
.delivery-address-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.delivery-address-head h3 { margin:0; font-size:16px; }
.address-book-list { display:grid; gap:8px; }
.address-book-item { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; border:1px solid #e2e5ea; border-radius:8px; padding:8px; }
.address-book-item.selected { border-color:#2c66c5; background:#f3f8ff; }
.address-select-btn { border:none; background:none; padding:0; text-align:left; cursor:pointer; color:#253041; font: inherit; }
.address-select-btn span { display:block; color:#6a7280; font-size:13px; margin-top:4px; }
.address-book-empty { font-size:14px; color:#7f8794; border:1px dashed #d2d8e1; border-radius:8px; padding:8px; }

.loyalty-widget { border:1px solid #d8e2f5; background:linear-gradient(160deg, #f7f9ff 0%, #eef3ff 100%); border-radius:14px; padding:12px; display:grid; gap:8px; box-shadow: 0 12px 24px rgba(63, 87, 231, .08); }
.loyalty-widget h3 { margin:0; font-size:16px; }
.loyalty-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.loyalty-badge { font-size:12px; font-weight:700; color:#2149d8; background:#e8eeff; border:1px solid #cbd8ff; padding:4px 8px; border-radius:999px; }
.loyalty-tabs { display:flex; gap:8px; overflow:auto; padding-bottom:2px; }
.loyalty-tab { border:none; background:#e9edff; color:#334174; border-radius:999px; padding:6px 12px; font-weight:700; white-space:nowrap; cursor:pointer; }
.loyalty-tab.is-active { background:linear-gradient(135deg, #5a6ff0, #3f57e7); color:#fff; }
.loyalty-row { display:flex; gap:8px; align-items:center; }
.loyalty-row input { flex:1; }
.loyalty-action-btn { min-width: 108px; }
.loyalty-code-status { border:1px solid #d8e2f5; background:#fff; border-radius:10px; padding:8px; font-size:13px; color:#2f3f55; }
.loyalty-code-status.error { border-color:#f1b4b8; background:#fff1f2; color:#a72a35; }
.loyalty-commit-btn { width:100%; }
