/**
 * Canonical design tokens — single source of truth.
 * DO NOT add a second :root block elsewhere (PHP views, admin CSS, etc.) — extend tokens only here.
 *
 * Legacy names (--gold, --bg, …) are kept for compatibility.
 * Use semantic tokens (--color-*) for new code; legacy tokens remain for existing markup/CSS.
 */
:root {
    --gold: #FABE23;
    --gold-light: #FFD54F;
    --gold-dark: #C79B00;
    --gold-gradient: linear-gradient(135deg, #FABE23 0%, #FFD54F 50%, #C79B00 100%);
    
    --bg: #013220;
    --bg-secondary: #011a12;
    --panel: #022b1a;
    --panel-hover: #033d25;
    --panel-active: #045230;
    
    --border: rgba(255, 255, 255, 0.05);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-gold: rgba(250, 190, 35, 0.3);
    
    --text: #ffffff;
    --text-secondary: #a0a4b0;
    --text-muted: #6b7080;
    
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    /* Alias used in some views (maps to --error) */
    --danger: var(--error);

    /* Checkout / marketing accents (same values as former checkout :root) */
    --emerald: #059669;
    --emerald-light: #10b981;
    --emerald-glow: rgba(5, 150, 105, 0.18);
    --emerald-border-soft: rgba(16, 185, 129, 0.25);
    --emerald-border-medium: rgba(16, 185, 129, 0.35);
    --emerald-fill-soft: rgba(16, 185, 129, 0.25);

    /* Semantic aliases — preferred for new code (legacy --gold etc. unchanged). No raw hex in views/JS when a token exists. */
    --color-primary: var(--gold);
    --color-primary-light: var(--gold-light);
    --color-primary-dark: var(--gold-dark);
    --color-bg: var(--bg);
    --color-bg-secondary: var(--bg-secondary);
    --color-surface: var(--panel);
    --color-surface-hover: var(--panel-hover);
    --color-text: var(--text);
    --color-text-secondary: var(--text-secondary);
    --color-text-muted: var(--text-muted);
    --color-success: var(--success);
    --color-error: var(--error);
    --color-danger: var(--error);
    --color-warning: var(--warning);
    --color-info: var(--info);
    
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-gold: 0 0 30px rgba(250, 190, 35, 0.15);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    --transition-normal: all 0.4s ease;
    --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    --ui-space-1: 4px;
    --ui-space-2: 8px;
    --ui-space-3: 12px;
    --ui-space-4: 16px;
    --ui-space-5: 20px;
}

/* Builder Review Page - Visual Receipt */
.review-item-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eaeaea;
}

.review-item-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
}

/* Modifier for Designer Style Hero Image */
.thumb-hero {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    border: 2px solid #d4af37; /* Adjust to match theme */
}

.review-item-details {
    display: flex;
    flex-direction: column;
}

/* Payment Page - Order Summary (premium) */
.pay-order-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.pay-order-card__title {
    margin: 0;
}
.pay-order-meta {
    text-align: right;
    min-width: 160px;
}
.pay-order-meta__row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    line-height: 1.25;
    margin-bottom: 6px;
}
.pay-order-meta__label {
    color: var(--text-muted);
    font-size: 12px;
}
.pay-order-meta__value {
    color: var(--text);
    font-weight: 700;
    font-size: 12px;
}
.pay-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.pay-order-item:last-of-type {
    border-bottom: 0;
}
.pay-order-item__thumb img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(255,255,255,0.08);
}
.pay-order-item__info {
    flex: 1;
    min-width: 0;
}
.pay-order-item__name {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pay-order-item__meta {
    font-size: 12px;
    color: var(--text-secondary);
}
.pay-order-item__price {
    font-weight: 800;
    color: var(--gold);
    font-size: 14px;
    flex-shrink: 0;
}
.pay-order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 2px solid var(--border);
}
.pay-order-total__amt {
    color: var(--gold);
    font-weight: 900;
    font-size: 1.15rem;
}
@media (max-width: 420px) {
    .pay-order-card__header {
        flex-direction: column;
        align-items: flex-start;
    }
    .pay-order-meta {
        text-align: left;
        min-width: 0;
    }
}

/* Order Success - Receipt */
.ok-receipt {
    text-align: left;
}
.ok-meta {
    margin-top: 14px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 12px;
}
.ok-meta__row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.ok-meta__row:last-child { border-bottom: 0; }
.ok-meta__label { color: var(--text-muted); font-size: 12px; }
.ok-meta__value { color: var(--text); font-weight: 700; font-size: 12px; text-align: right; }
.ok-meta__mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; letter-spacing: 0.3px; }

.ok-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.ok-line__thumb {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.ok-line__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ok-line__thumb-fallback {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-weight: 900;
    font-size: 22px;
}
.ok-line__thumb.is-fallback .ok-line__thumb-fallback { display: flex; }
.ok-line__info { flex: 1; min-width: 0; }
.ok-line__name {
    color: var(--text);
    font-weight: 800;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.ok-line__meta { color: var(--text-secondary); font-size: 12px; }
.ok-line__price { color: var(--gold); font-weight: 900; font-size: 14px; }

.ok-totals {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid var(--border);
}
.ok-total-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.ok-total-row .val { color: var(--text); font-weight: 700; }
.ok-discount { color: var(--success) !important; }
.ok-total-row--grand {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.ok-grand { color: var(--gold) !important; font-weight: 900; font-size: 16px; }

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.58;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    animation: fadeIn 0.4s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: inherit;
    font-weight: 600;
    line-height: 1.28;
}

button,
.btn,
.nav-btn,
.ui-btn,
.mobile-nav-btn,
input,
select,
textarea {
    font-family: inherit;
    line-height: 1.38;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    line-height: 1.42;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--gold-light);
}

img {
    max-width: 100%;
    height: auto;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--color-primary);
    color: #000;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    color: #000;
    box-shadow: var(--shadow-gold);
}

.btn-secondary {
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    background: transparent;
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: #000;
}

.btn-outline {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
}

.btn-outline:hover {
    background: rgba(250, 190, 35, 0.1);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card img {
    transition: transform 0.4s ease;
}

.card:hover img {
    transform: scale(1.05);
}

/* ── Skeleton loading (catalog grids: fabrics, products) ─────────── */
.skeleton-card {
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    min-height: 190px;
}

.skeleton-img {
    height: 120px;
    border-radius: var(--radius);
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--text) 5%, var(--panel)) 0%,
        color-mix(in srgb, var(--text) 12%, var(--panel)) 50%,
        color-mix(in srgb, var(--text) 5%, var(--panel)) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-img--tall {
    height: 220px;
}

.skeleton-img--ratio45 {
    width: 100%;
    aspect-ratio: 4 / 5;
    min-height: 160px;
    height: auto;
}

.skeleton-text {
    height: 12px;
    margin-top: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    background: color-mix(in srgb, var(--text) 10%, var(--panel));
}

.skeleton-text + .skeleton-text {
    margin-top: 8px;
}

.skeleton-text--short {
    width: 58%;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

.catalog-grid-loading {
    position: relative;
}

.catalog-grid-loading:not(.is-loaded) .catalog-real-layer {
    display: none;
}

.catalog-grid-loading:not(.is-loaded) .catalog-skeleton-layer {
    pointer-events: auto;
}

.catalog-grid-loading .catalog-real-layer {
    position: relative;
    z-index: 1;
}

.catalog-grid-loading .catalog-skeleton-layer {
    position: relative;
    z-index: 2;
    transition: opacity 0.26s ease, visibility 0s linear;
}

.catalog-grid-loading.is-loaded .catalog-skeleton-layer,
.catalog-grid-loading.skeleton-loaded .catalog-skeleton-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.26s ease, visibility 0s linear 0.26s;
}

.catalog-grid-loading.is-loaded .catalog-skeleton-layer *,
.catalog-grid-loading.skeleton-loaded .catalog-skeleton-layer * {
    pointer-events: none;
}

.skeleton-loaded .skeleton::after {
    opacity: 0;
    animation: none;
}

.catalog-skeleton-layer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.card-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gold);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(250, 190, 35, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

.badge-gold {
    background: rgba(250, 190, 35, 0.15);
    color: var(--gold);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.flex { display: flex; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { align-items: center; justify-content: space-between; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: var(--panel-hover);
}

.qty-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.qty-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.qty-control button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.qty-control button:hover {
    background: var(--panel-hover);
    color: var(--gold);
}

.qty-control .qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.qty-control .qty-btn:hover {
    background: var(--panel-hover);
    color: var(--gold);
}

.qty-control input {
    width: 40px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text);
    text-align: center;
    font-size: 14px;
    -moz-appearance: textfield;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.update-btn {
    padding: 6px 12px;
    background: var(--panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.update-btn:hover {
    background: var(--panel-hover);
    border-color: var(--gold);
    color: var(--gold);
}

/* Cart qty controls (mobile-first, high-contrast) */
.cart-item .qty-control {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #fff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 10px !important;
    padding: 4px 6px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.cart-item .qty-control button,
.cart-item .qty-minus,
.cart-item .qty-plus {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    border: 1px solid #ddd !important;
    background: #f8f8f8 !important;
    color: #222 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}

@media (hover: hover) {
    .cart-item .qty-control button:hover,
    .cart-item .qty-minus:hover,
    .cart-item .qty-plus:hover {
        background: #eee !important;
    }
}

.cart-item .qty-control button:active,
.cart-item .qty-minus:active,
.cart-item .qty-plus:active {
    transform: scale(0.95);
    background: #ddd !important;
}

.cart-item .qty-control input {
    width: 36px !important;
    text-align: center !important;
    border: none !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    background: transparent !important;
    color: #111 !important;
}

.cart-item .qty-value {
    color: #111 !important;
    font-weight: 600 !important;
}

.cart-item .qty-control input::-webkit-outer-spin-button,
.cart-item .qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-item .qty-control input[type=number] {
    -moz-appearance: textfield;
}

/* Mobile spacing tune for cart cards */
.cart-item {
    padding: 12px !important;
    margin-bottom: 12px !important;
}

.item-info,
.item-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Keep backend fallback button in DOM, hide in UI */
.update-btn {
    display: none !important;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(250, 190, 35, 0.05);
}

.remove-form {
    display: inline-block;
}

.remove-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
}

/* ── Mobile-first touch-friendly base ────────────────────────────── */
@media (max-width: 768px) {
    .btn, button[type="submit"], .btn-primary, .btn-outline {
        min-height: 48px;
        font-size: 0.95rem;
    }
    input[type="text"], input[type="email"], input[type="password"], input[type="tel"], select, textarea {
        min-height: 48px;
        font-size: 16px;
    }
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    body {
        animation: none;
    }

    .btn,
    .card,
    .card img {
        transition: none;
    }

    .btn:hover,
    .btn:active,
    .card:hover,
    .card:hover img {
        transform: none;
    }

    .skeleton-img {
        animation: none;
    }
}

/* Unified design-system layer (homepage-aligned, additive only) */
.ui-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    box-shadow: var(--shadow, 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3));
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ui-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.ui-input {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text);
}

.ui-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(250, 190, 35, 0.1);
}

.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.ui-btn:active {
    transform: scale(0.98);
}

.ui-btn-primary {
    background: var(--gold-gradient);
    color: var(--bg);
    border-color: var(--gold);
}

.ui-btn-secondary {
    background: transparent;
    color: var(--gold);
    border-color: var(--border-gold);
}

.ui-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
    background: var(--panel);
    color: var(--text-secondary);
    white-space: nowrap;
    transition: var(--transition-fast);
}
.ui-chip:active {
    transform: scale(0.98);
}

.ui-chip:hover,
.ui-chip.is-active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(250, 190, 35, 0.08);
}

.chip-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.chip-scroll::-webkit-scrollbar {
    display: none;
}

.ui-sticky-bar {
    position: sticky;
    bottom: 0;
    z-index: 1002;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4));
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

/* Premium spacing helpers */
.ui-space-1 { gap: var(--ui-space-1); }
.ui-space-2 { gap: var(--ui-space-2); }
.ui-space-3 { gap: var(--ui-space-3); }
.ui-space-4 { gap: var(--ui-space-4); }
.ui-space-5 { gap: var(--ui-space-5); }

/* Skeleton utilities */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    background: color-mix(in srgb, var(--text) 6%, var(--panel));
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent 0%,
        color-mix(in srgb, var(--text) 14%, transparent) 50%,
        transparent 100%
    );
    animation: ui-skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes ui-skeleton-shimmer {
    100% { transform: translateX(100%); }
}

.item-image.skeleton {
    min-height: 140px;
}

@media (hover: hover) and (pointer: fine) {
    .ui-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }
}

/* Global safe bridge: apply unified layer to existing page components */
:where(.product-card, .fabric-card, .cart-item, .filter-card, .order-summary, .empty-cart) {
    border-radius: var(--radius-lg);
}

:where(.product-card, .fabric-card, .cart-item) {
    overflow: hidden;
}

:where(.btn, .action-btn, .nav-btn, .mobile-nav-btn) {
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

:where(input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], select, textarea) {
    border-radius: var(--radius);
}

:where(.category-list, .filter-list) {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

:where(.chip-scroll, .category-list, .filter-list) {
    scrollbar-width: none;
}

:where(.chip-scroll, .category-list, .filter-list)::-webkit-scrollbar {
    display: none;
}

:where(.category-link, .filter-link) {
    transition: var(--transition-fast);
}

:where(.category-link:active, .filter-link:active) {
    transform: scale(0.98);
}

:where(.cart-summary, .mobile-sticky-bar, .builder-zomato-footer) {
    z-index: 1002;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 900px) {
    :where(.main-content, .page-wrapper, .fabrics-main, .shop-layout, .cart-layout, .builder-container) {
        padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    }
}

/* Card image ratios (fabric + shop grids) */
.fabric-card .fabric-image,
.product-card .product-image {
    aspect-ratio: 1 / 1;
}

.fabric-card .fabric-image img,
.product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Empty state hook (page-specific padding/visuals keep priority) */
.ui-empty-state {
    text-align: center;
    border-radius: var(--radius-lg);
}

.ui-empty-state + .catalog-grid-loading {
    margin-top: 12px;
}

/* Interaction feedback (brightness on tap — additive, low cost) */
.btn:active,
.ui-btn:active,
.ui-chip:active,
.category-link:active,
.filter-link:active,
button:not(:disabled):active {
    filter: brightness(1.07);
}

/* perf hints — desktop pointers only */
@media (hover: hover) and (pointer: fine) {
    .ui-card,
    .ui-btn,
    .ui-chip {
        will-change: transform;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton::after,
    .skeleton-img {
        animation: none !important;
    }

    .ui-btn,
    .ui-chip,
    .ui-card,
    .category-link,
    .filter-link {
        transition: none !important;
    }

    .catalog-grid-loading.is-loaded .catalog-skeleton-layer,
    .catalog-grid-loading.skeleton-loaded .catalog-skeleton-layer {
        transition: opacity 0s !important;
        opacity: 0 !important;
    }

    .catalog-grid-loading .catalog-skeleton-layer {
        transition: none !important;
    }

    .ui-card,
    .ui-btn,
    .ui-chip {
        will-change: auto;
    }
}
