:root {
    --ink: #16283A; --ink-2: #3D5468; --muted: #64748B;
    --line: #D8E1EA; --soft: #F3F6F9; --panel: #FFFFFF; --page-bg: #F0F4F8;
    --brand: #14507C; --brand-dark: #0C3355;
    --accent: #D9531E; --accent-soft: #FBE9E0;
    --success: #16835F; --danger: #C2410C;
    --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(12,51,85,.08);
    --shadow-md: 0 6px 18px rgba(12,51,85,.10);
    --shadow-lg: 0 18px 45px rgba(12,51,85,.14);
    --font-body: 'Noto Sans TC','Microsoft JhengHei',Arial,sans-serif;
    --font-display: 'Noto Serif TC','PMingLiU',serif;
    --font-mono: 'IBM Plex Mono','Consolas',monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--page-bg);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(18px, 4vw, 48px);
    border-bottom: 1px solid rgba(255,255,255,.12);
    background: var(--brand-dark);
    box-shadow: var(--shadow-sm);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: rgba(255,255,255,.92);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    color: var(--brand-dark);
    background: var(--panel);
    font-weight: 900;
    letter-spacing: 0;
}

.brand strong {
    display: block;
    color: rgba(255,255,255,.92);
    font-size: 1.08rem;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.brand small {
    display: block;
    color: rgba(255,255,255,.6);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-left: auto;
}

.header-nav a {
    position: relative;
    color: rgba(255,255,255,.92);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: color .18s ease;
}

.header-nav a::after {
    position: absolute;
    right: 0;
    bottom: -7px;
    left: 0;
    height: 2px;
    background: var(--accent);
    content: "";
    transform: scaleX(0);
    transform-origin: center;
    transition: transform .18s ease;
}

.header-nav a:hover {
    color: var(--panel);
}

.header-nav a:hover::after {
    transform: scaleX(1);
}

.header-cart-btn,
.primary-link,
.secondary-link,
.add-to-cart,
.secondary-action,
.checkout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font-weight: 700;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
}

.header-cart-btn {
    flex: 0 0 auto;
    gap: 10px;
    padding: 10px 16px;
    color: var(--panel);
    background: var(--accent);
    box-shadow: var(--shadow-sm);
}

.header-cart-btn:hover,
.primary-link:hover,
.secondary-link:hover,
.add-to-cart:hover,
.secondary-action:hover,
.checkout-btn:hover {
    transform: translateY(-1px);
}

.header-cart-btn:hover {
    background: var(--danger);
    box-shadow: var(--shadow-md);
}

.cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--accent);
    background: var(--panel);
    font-family: var(--font-mono);
    font-size: 0.88rem;
}

.badge-pulse {
    animation: badgePulse .34s ease-out;
}

@keyframes badgePulse {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.28);
    }

    100% {
        transform: scale(1);
    }
}

.scale-rule {
    height: 10px;
    border-bottom: 1px solid var(--line);
    background-image:
        repeating-linear-gradient(90deg, var(--brand) 0 1px, transparent 1px 40px),
        repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 8px);
    background-repeat: repeat-x;
    background-size: auto 10px;
}

.hero-scale-rule {
    width: min(180px, 100%);
    margin-top: 14px;
    background-image:
        repeating-linear-gradient(90deg, var(--accent) 0 1px, transparent 1px 40px),
        repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 8px);
}

.section-scale-rule {
    flex: 1 0 100%;
    margin-top: 2px;
}

.footer-scale-rule {
    width: 100%;
}

.hero-banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background: var(--soft);
}

.hero-banner::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, rgba(12,39,64,.92) 0%, rgba(12,39,64,.55) 45%, rgba(12,39,64,.15) 100%);
    content: "";
    pointer-events: none;
}

.hero-banner img {
    display: block;
    width: 100%;
    height: auto;
}

.hero-intro {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 680px) minmax(280px, 1fr);
    gap: clamp(24px, 5vw, 52px);
    align-items: end;
    justify-content: space-between;
    width: min(1100px, calc(100% - clamp(28px, 6vw, 64px)));
    max-width: 1100px;
    margin: -48px auto 0;
    padding: 34px clamp(22px, 5vw, 54px) 38px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--r-lg);
    background: var(--panel);
    box-shadow: var(--shadow-md);
}

.hero-content {
    max-width: 720px;
    min-width: 0;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-content h1 {
    margin: 0;
    max-width: 720px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 4.5vw, 3rem);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0;
    word-break: keep-all;
    overflow-wrap: normal;
}

.hero-content p {
    max-width: 640px;
    margin: 18px 0 0;
    color: var(--ink-2);
    font-size: 1.06rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.primary-link {
    padding: 12px 22px;
    color: var(--panel);
    background: var(--accent);
    box-shadow: var(--shadow-sm);
}

.primary-link:hover {
    background: var(--danger);
    box-shadow: var(--shadow-md);
}

.secondary-link {
    padding: 12px 22px;
    color: var(--brand);
    background: transparent;
    border-color: var(--brand);
}

.secondary-link:hover {
    color: var(--panel);
    background: var(--brand);
    box-shadow: var(--shadow-sm);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    margin-top: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.hero-stats div {
    padding: 18px;
    background: var(--panel);
}

.hero-stats div + div {
    border-left: 1px solid var(--line);
}

.hero-stats strong {
    display: block;
    color: var(--brand-dark);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.25;
}

.hero-stats span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.main-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    width: min(1420px, calc(100% - clamp(28px, 4vw, 40px)));
    margin: 44px auto 0;
}

.sidebar {
    position: sticky;
    top: 86px;
    flex: 0 0 240px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.sidebar h2 {
    margin: 0 0 14px;
    color: var(--ink);
    font-size: 1rem;
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px 11px 14px;
    border-left: 3px solid transparent;
    border-radius: var(--r-sm);
    color: var(--muted);
    font-weight: 700;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.cat-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: currentColor;
}

.cat-icon svg {
    display: block;
    width: 20px;
    height: 20px;
}

.cat-label {
    min-width: 0;
}

.sidebar li:hover {
    color: var(--brand);
    background: var(--soft);
}

.sidebar li.active {
    color: var(--brand-dark);
    border-left-color: var(--accent);
    background: var(--accent-soft);
    font-weight: 900;
}

.content-area {
    flex: 1;
    min-width: 0;
}

.section-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px 24px;
    margin-top: 8px;
    margin-bottom: 22px;
}

.section-heading h2 {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

.section-heading p {
    max-width: 480px;
    margin: 20px 0 0;
    color: var(--muted);
}

.search-bar-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

#search-input,
#sort-select,
.customer-form input {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--ink);
    background-color: var(--panel);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

#search-input {
    flex: 1 1 280px;
    padding: 11px 13px 11px 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 15px 50%;
    background-size: 18px 18px;
}

#sort-select,
.customer-form input {
    padding: 11px 13px;
}

#search-input:focus,
#sort-select:focus,
.customer-form input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(20,80,124,.15);
}

#sort-select {
    flex: 0 1 190px;
    max-width: 190px;
}

.brand-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.brand-chip {
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--muted);
    background: var(--panel);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.brand-chip:hover {
    color: var(--brand);
    background: var(--soft);
}

.brand-chip.active {
    color: var(--brand-dark);
    border-color: var(--accent);
    background: var(--accent-soft);
    font-weight: 900;
}

.catalog-feedback {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.9rem;
}

.catalog-feedback button {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--brand-dark);
    background: var(--panel);
    font-size: 0.84rem;
    font-weight: 700;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.catalog-feedback button:hover {
    border-color: var(--brand);
    background: var(--soft);
}

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 278px), 1fr));
    gap: 20px;
}

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 438px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.product-card::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent);
    content: "";
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .18s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--brand);
    box-shadow: var(--shadow-lg);
}

.product-card:hover::before {
    transform: scaleX(1);
}

.product-card img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: radial-gradient(circle at 50% 40%, #FFFFFF, #F2F6F9);
    cursor: pointer;
}

.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.load-more-container:empty {
    display: none;
}

.load-more-button {
    min-width: min(100%, 280px);
    padding: 12px 18px;
    border: 1px solid var(--brand);
    border-radius: var(--r-sm);
    color: var(--brand);
    background: var(--panel);
    font-weight: 800;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.load-more-button:hover {
    color: var(--brand-dark);
    border-color: var(--brand-dark);
    background: var(--soft);
    box-shadow: var(--shadow-sm);
}

.product-card h3 {
    margin: 5px 0 8px;
    color: var(--ink);
    font-size: 1.12rem;
    line-height: 1.35;
}

mark {
    padding: 0 .1em;
    border-radius: 3px;
    color: inherit;
    background: var(--accent-soft);
    font-weight: inherit;
}

.product-code,
.modal-product-code {
    margin: 12px 0 0;
    color: var(--brand-dark);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.product-code {
    color: var(--brand);
    font-weight: 600;
}

.modal-product-code {
    margin: 0 0 6px;
    padding-right: 34px;
    font-size: 1rem;
    letter-spacing: 0;
}

.product-category-label {
    align-self: flex-start;
    max-width: 100%;
    margin-top: 12px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--brand-dark);
    background: var(--soft);
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.product-category-label:hover {
    border-color: var(--brand);
    background: var(--accent-soft);
}

.product-desc {
    flex: 1;
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.product-tag {
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-2);
    background: var(--soft);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.product-tag:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
    background: var(--accent-soft);
}

.price {
    margin: 14px 0;
    color: var(--danger);
    font-family: var(--font-mono);
    font-size: 1.24rem;
    font-weight: 600;
    text-align: right;
}

.product-card-actions {
    display: grid;
    gap: 10px;
}

.product-card-actions .add-to-cart {
    margin-top: 0;
}

.add-to-cart {
    width: 100%;
    margin-top: 16px;
    padding: 12px 14px;
    color: var(--panel);
    background: var(--brand);
}

.add-to-cart:hover {
    background: var(--brand-dark);
    box-shadow: var(--shadow-md);
}

.secondary-action {
    width: 100%;
    padding: 12px 14px;
    border-color: var(--brand);
    color: var(--brand);
    background: transparent;
}

.secondary-action:hover {
    color: var(--brand-dark);
    border-color: var(--brand-dark);
    background: var(--soft);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(8,18,29,.62);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    width: min(900px, calc(100vw - 24px));
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    border-radius: var(--r-md);
    background: var(--panel);
    box-shadow: var(--shadow-lg);
}

.cart-modal-content {
    max-width: 560px;
}

.product-modal-content {
    width: min(1080px, calc(100vw - 24px));
}

.cart-modal-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-right: 38px;
}

.modal-content h2 {
    margin: 0;
    color: var(--ink);
}

.modal-subtitle {
    margin: 6px 0 18px;
    color: var(--muted);
}

.close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    width: 38px;
    height: 38px;
    border: 0;
    color: var(--muted);
    background: transparent;
    font-size: 30px;
    line-height: 1;
    transition: color .18s ease;
}

.close-btn:hover {
    color: var(--ink);
}

.cart-item {
    display: flex;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.cart-item-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.cart-item-header,
.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.cart-item-header {
    font-weight: 700;
}

.clear-cart-btn {
    min-height: 28px;
    padding: 0;
    border: 0;
    color: var(--danger);
    background: transparent;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.clear-cart-btn:hover {
    color: var(--accent);
}

.cart-total {
    margin-top: 18px;
    color: var(--danger);
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: right;
}

.customer-form {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.customer-form h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.form-field {
    margin-bottom: 11px;
}

.customer-form input {
    margin-bottom: 0;
}

.customer-form input.invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(194,65,12,.14);
}

.field-error {
    min-height: 18px;
    margin-top: 4px;
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
}

.checkout-alert {
    margin-bottom: 14px;
    padding: 11px 13px;
    border-radius: var(--r-sm);
    color: var(--panel);
    background: var(--danger);
    font-size: 0.92rem;
    font-weight: 700;
}

.checkout-alert a {
    color: var(--panel);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.checkout-btn {
    width: 100%;
    margin-top: 8px;
    padding: 13px 16px;
    color: var(--panel);
    background: var(--accent);
}

.checkout-btn:hover {
    background: var(--danger);
}

.checkout-btn:disabled {
    cursor: not-allowed;
    opacity: 0.68;
    transform: none;
}

.empty-state {
    margin: 0;
    padding: 26px 0;
    color: var(--muted);
    text-align: center;
}

.empty-state p {
    margin: 0;
}

.catalog-empty-state {
    display: grid;
    justify-items: center;
    gap: 16px;
}

.catalog-empty-actions,
.catalog-popular-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.catalog-empty-actions .secondary-action,
.catalog-empty-actions .add-to-cart {
    width: auto;
    min-width: 150px;
    margin-top: 0;
}

.catalog-popular-categories {
    color: var(--muted);
    font-size: 0.9rem;
}

.catalog-popular-categories span {
    align-self: center;
    font-weight: 700;
}

.catalog-popular-categories button {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--brand-dark);
    background: var(--panel);
    font-size: 0.84rem;
    font-weight: 700;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.catalog-popular-categories button:hover {
    border-color: var(--brand);
    background: var(--accent-soft);
}

.cart-empty-state {
    display: grid;
    justify-items: center;
    gap: 14px;
}

.empty-browse-btn,
.continue-browse-btn {
    width: auto;
    min-width: 150px;
}

.checkout-success {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 20px 0 6px;
    text-align: center;
}

.checkout-success[hidden] {
    display: none;
}

#cart-flow-content[hidden],
.checkout-alert[hidden],
.clear-cart-btn[hidden],
.floating-cart-badge[hidden] {
    display: none !important;
}

.checkout-success-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 999px;
    color: var(--panel);
    background: var(--success);
}

.checkout-success-icon svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.checkout-success h3 {
    margin: 0;
    color: var(--ink);
    font-size: 1.18rem;
}

.checkout-success p {
    margin: 0;
    color: var(--muted);
}

.submitted-items {
    display: grid;
    gap: 8px;
    width: 100%;
    margin: 4px 0 2px;
    padding: 0;
    list-style: none;
    text-align: left;
}

.submitted-items li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--soft);
}

.submitted-items span {
    min-width: 0;
}

.submitted-items strong {
    flex: 0 0 auto;
    color: var(--brand-dark);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.modal-body-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "image"
        "info"
        "details"
        "action";
    gap: 18px;
}

.modal-image {
    grid-area: image;
    min-width: 0;
}

.modal-info {
    display: flex;
    grid-area: info;
    flex-direction: column;
    min-width: 0;
}

.modal-breadcrumb {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.modal-info h2 {
    margin-top: 0;
    padding-right: 34px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

.modal-info .product-desc {
    flex: 0 0 auto;
    margin: 12px 0 0;
    color: var(--ink-2);
}

.modal-info .price {
    text-align: left;
}

.product-action-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: center;
    margin: 18px 0 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--soft);
}

.modal-body-layout > .product-action-panel {
    grid-area: action;
    align-self: start;
    margin: 0;
}

.product-action-panel .qty-control {
    flex: 0 0 auto;
    margin: 0;
}

.product-action-panel .add-to-cart {
    flex: 1 1 240px;
    min-width: 220px;
    margin-top: 0;
}

.product-detail-content {
    grid-area: details;
    min-width: 0;
    margin-top: 6px;
}

.product-detail-section {
    margin-top: 20px;
}

.product-detail-section:first-child {
    margin-top: 0;
}

.product-detail-section h3 {
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    color: var(--brand-dark);
    font-size: 1rem;
}

.product-features-list {
    margin: 0;
    padding-left: 20px;
    color: var(--ink-2);
}

.product-features-list li {
    margin-bottom: 8px;
}

.modal-product-code {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    color: var(--ink);
}

.modal-product-code strong {
    color: var(--brand-dark);
    font-weight: 800;
}

.modal-brand-badge {
    max-width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--brand-dark);
    background: var(--soft);
    font-weight: 700;
    line-height: 1.2;
}

.modal-code-divider {
    color: var(--muted);
}

.carousel-container {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--panel);
}

.carousel-container img {
    display: block;
    width: 100%;
    height: min(460px, 55vh);
    object-fit: contain;
    padding: 14px;
    cursor: zoom-in;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    width: 42px;
    height: 48px;
    border: 0;
    color: var(--panel);
    background: rgba(12,51,85,.72);
    font-size: 1.35rem;
    transform: translateY(-50%);
    transition: background-color .18s ease;
}

.carousel-btn:hover {
    background: rgba(12,51,85,.92);
}

.carousel-btn.prev {
    left: 0;
}

.carousel-btn.next {
    right: 0;
}

.carousel-indicators {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}

.carousel-indicators .thumb {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: var(--r-sm);
    opacity: 0.58;
    cursor: pointer;
    transition: border-color .18s ease, opacity .18s ease;
}

.carousel-indicators .thumb.active,
.carousel-indicators .thumb:hover {
    border-color: var(--brand);
    opacity: 1;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
}

.qty-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--ink);
    background: var(--soft);
    font-size: 1.1rem;
    transition: background-color .18s ease, border-color .18s ease;
}

.qty-btn:hover {
    border-color: var(--brand);
    background: var(--accent-soft);
}

.qty-input {
    width: 56px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    text-align: center;
}

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

.remove-btn {
    min-height: 34px;
    padding: 6px 12px;
    border: 0;
    border-radius: var(--r-sm);
    color: var(--panel);
    background: var(--danger);
    font-size: 0.9rem;
    font-weight: 700;
    transition: background-color .18s ease;
}

.remove-btn:hover {
    background: var(--accent);
}

.spec-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

.spec-table {
    display: table;
    width: 100%;
    min-width: 520px;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.94rem;
}

.spec-table th,
.spec-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.spec-table tr:last-child th,
.spec-table tr:last-child td {
    border-bottom: 0;
}

.spec-table tbody tr:nth-child(even) {
    background: var(--soft);
}

.spec-table th {
    width: 32%;
    color: var(--ink-2);
    background: transparent;
    white-space: nowrap;
}

.spec-table td {
    color: var(--ink-2);
    background: transparent;
}

.lightbox {
    z-index: 2000;
    background: rgba(0,0,0,.9);
}

.lightbox img {
    max-width: 92%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--r-sm);
}

.lightbox-close {
    color: var(--panel);
}

#toast-container {
    position: fixed;
    top: 82px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    max-width: min(360px, calc(100vw - 40px));
    padding: 13px 16px;
    border-left: 4px solid var(--success);
    border-radius: var(--r-md);
    color: var(--panel);
    background: var(--brand-dark);
    box-shadow: var(--shadow-lg);
    font-weight: 700;
    opacity: 0;
    transform: translateX(120%);
    transition: transform .18s ease, opacity .18s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.floating-cart-btn {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 920;
    display: none;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 999px;
    color: var(--panel);
    background: var(--accent);
    box-shadow: var(--shadow-lg);
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.floating-cart-btn:hover {
    background: var(--danger);
    transform: translateY(-2px);
}

.floating-cart-btn svg {
    width: 29px;
    height: 29px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.floating-cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    display: grid;
    place-items: center;
    min-width: 25px;
    height: 25px;
    padding: 0 7px;
    border: 2px solid var(--panel);
    border-radius: 999px;
    color: var(--panel);
    background: var(--brand-dark);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
}

.modal-open .floating-cart-btn {
    display: none;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(243,246,249,.96);
    transition: opacity .18s ease;
}

.loading-overlay p {
    margin-top: 14px;
    color: var(--brand-dark);
    font-weight: 700;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 5px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.service-section {
    margin-top: 64px;
    padding: 0 clamp(18px, 4vw, 48px);
}

.service-inner {
    width: min(1420px, 100%);
    margin: 0 auto;
}

.service-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 16px;
    margin-top: 26px;
}

.service-card {
    padding: 22px 20px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--accent);
    border-radius: var(--r-md);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.service-card h3 {
    margin: 0 0 6px;
    color: var(--brand-dark);
    font-size: 1.05rem;
}

.service-card p {
    margin: 0;
    color: var(--ink-2);
    font-size: 0.94rem;
}

.service-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 16px;
    list-style: none;
    margin: 30px 0 0;
    padding: 26px clamp(20px, 3vw, 34px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.service-steps li {
    display: grid;
    gap: 4px;
}

.service-steps .step-num {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 600;
}

.service-steps strong {
    color: var(--ink);
    font-size: 1.02rem;
}

.service-steps li > span:last-child {
    color: var(--muted);
    font-size: 0.9rem;
}

footer {
    margin-top: 58px;
    color: rgba(255,255,255,.85);
    background: var(--brand-dark);
}

.footer-inner {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 30px 0 22px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1.1fr;
    gap: 28px;
}

.footer-column h2 {
    margin: 0 0 10px;
    color: var(--panel);
    font-size: 1rem;
}

.footer-column:first-child h2 {
    font-family: var(--font-display);
    font-weight: 700;
}

.footer-column p {
    margin: 0;
}

.footer-column p + p {
    margin-top: 8px;
}

.footer-links {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-column a,
.footer-link-button {
    color: rgba(255,255,255,.85);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color .18s ease;
}

.footer-column a:hover,
.footer-link-button:hover {
    color: var(--panel);
}

.footer-link-button {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
}

.footer-bottom {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.14);
    color: rgba(255,255,255,.72);
    font-size: 0.9rem;
    text-align: center;
}

@media (min-width: 1100.02px) {
    .hero-stats {
        grid-template-columns: 1fr;
        align-self: center;
    }

    .hero-stats div + div {
        border-top: 1px solid var(--line);
        border-left: 0;
    }
}

@media (max-width: 1100px) {
    .hero-intro {
        display: flex;
        align-items: stretch;
        flex-direction: column;
    }

    .hero-content {
        max-width: 760px;
    }
}

@media (min-width: 900px) {
    .modal-body-layout {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 0.92fr);
        grid-template-areas:
            "image info"
            "image action"
            "details details";
        gap: 24px 28px;
        align-items: start;
    }
}

@media (max-width: 899.98px) {
    .product-modal-content {
        max-height: calc(100dvh - 24px);
        padding-bottom: 0;
    }

    .modal-body-layout {
        grid-template-areas:
            "image"
            "info"
            "details"
            "action";
    }

    .product-detail-content {
        padding-bottom: 96px;
    }

    .modal-body-layout > .product-action-panel {
        position: sticky;
        bottom: 0;
        z-index: 3;
        margin: 0 -28px;
        padding: 12px 28px calc(12px + env(safe-area-inset-bottom));
        border: 0;
        border-top: 1px solid var(--line);
        border-radius: 0;
        background: var(--panel);
        box-shadow: 0 -10px 24px rgba(12,51,85,.12);
    }
}

@media (max-width: 900px) {
    .floating-cart-btn {
        display: inline-flex;
    }

    .main-wrapper,
    .section-heading {
        display: flex;
        flex-direction: column;
    }

    .sidebar {
        position: static;
        width: 100%;
        flex: none;
    }

    .sidebar h2 {
        display: none;
    }

    #category-menu {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    #category-menu::-webkit-scrollbar {
        display: none;
    }

    .sidebar li {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .section-heading p {
        margin-top: 0;
    }

    .carousel-container img {
        height: min(380px, 52vh);
    }
}

@media (max-width: 719.98px) {
    .header-nav {
        display: none;
    }

    .hero-intro {
        width: min(100% - 28px, 1100px);
        margin-top: -28px;
        padding: 26px 18px 30px;
    }

    .hero-content h1 {
        font-size: clamp(1.7rem, 9vw, 2.4rem);
        word-break: normal;
        overflow-wrap: anywhere;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }
}

@media (max-width: 640px) {
    .site-header {
        align-items: stretch;
        flex-direction: column;
        padding: 12px 16px;
    }

    .header-cart-btn {
        width: 100%;
    }

    .hero-banner {
        min-height: 0;
    }

    .hero-actions,
    .search-bar-container {
        flex-direction: column;
    }

    #search-input {
        flex-basis: auto;
    }

    .spec-table {
        min-width: 0;
    }

    .spec-table th {
        width: 36%;
        white-space: normal;
    }

    .primary-link,
    .secondary-link,
    #sort-select {
        width: 100%;
        max-width: none;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .hero-stats div + div {
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .product-action-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .product-action-panel .qty-control {
        justify-content: space-between;
        width: 100%;
    }

    .product-action-panel .add-to-cart {
        width: 100%;
        min-width: 0;
        flex-basis: auto;
    }

    .carousel-container img {
        height: min(320px, 48vh);
    }

    .main-wrapper {
        width: min(100% - 28px, 1420px);
        margin-top: 44px;
    }

    .products {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 12px;
    }

    .modal-content {
        padding: 22px 18px;
    }

    .product-modal-content {
        padding-bottom: 0;
    }

    .modal-body-layout > .product-action-panel {
        margin-right: -18px;
        margin-left: -18px;
        padding-right: 18px;
        padding-left: 18px;
    }

    .cart-item-header,
    .cart-item-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    #toast-container {
        inset: auto 14px 18px 14px;
    }

    .toast,
    .toast.show {
        max-width: none;
        transform: translateY(0);
    }

    .floating-cart-btn {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom));
        width: 58px;
        height: 58px;
    }
}

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

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .header-cart-btn:hover,
    .primary-link:hover,
    .secondary-link:hover,
    .add-to-cart:hover,
    .checkout-btn:hover,
    .product-card:hover,
    .toast,
    .toast.show,
    .floating-cart-btn:hover {
        transform: none !important;
    }
}
