:root {
    --km-bg: #f7f2e9;
    --km-surface: #fffdf9;
    --km-surface-strong: #ffffff;
    --km-ink: #211d19;
    --km-muted: #7a7168;
    --km-accent: #a84e1c;
    --km-accent-dark: #7f3615;
    --km-accent-soft: #f3e2d5;
    --km-border: #e5dbcf;
    --km-border-strong: #d5c6b7;
    --km-success: #537c58;
    --km-shadow: 0 18px 48px rgba(75, 48, 27, 0.08);
    --km-radius-lg: 24px;
    --km-radius-md: 16px;
}

html { background: var(--km-bg); }

body.km-theme {
    min-height: 100vh;
    margin: 0;
    color: var(--km-ink);
    background: var(--km-bg);
    background-image: none !important;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.km-theme a { color: inherit; }

.km-theme .km-navbar {
    position: sticky;
    top: 18px;
    z-index: 1000;
    margin: 18px 0 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.km-navbar__shell {
    min-height: 74px;
    padding: 10px 14px 10px 24px;
    border: 1px solid rgba(213, 198, 183, 0.78);
    border-radius: 999px;
    background: rgba(255, 253, 249, 0.94);
    box-shadow: 0 10px 34px rgba(62, 42, 24, 0.08);
    backdrop-filter: blur(16px);
}

.km-brand {
    display: flex;
    min-width: 205px;
    margin-right: 34px;
    padding: 0;
    flex-direction: column;
    align-items: flex-start !important;
    line-height: 1;
}

.km-brand__name {
    color: var(--km-ink);
    font-family: Georgia, "Times New Roman", "Songti SC", serif;
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.km-brand__tagline {
    margin-top: 7px;
    color: var(--km-accent);
    font-size: 0.57rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.km-theme .km-nav { gap: 6px; }

.km-theme .navbar-acg .nav-link {
    padding: 10px 15px;
    border-radius: 999px;
    color: var(--km-muted);
    font-size: 0.88rem;
    font-weight: 600;
    transition: color .18s ease, background-color .18s ease;
}

.km-theme .navbar-acg .nav-link:hover,
.km-theme .navbar-acg .nav-link.active {
    color: var(--km-ink);
    background: var(--km-accent-soft);
}

.km-theme .navbar-acg .nav-link.active::after { display: none; }

.km-theme .lang-switch__btn,
.km-theme .km-btn-secondary,
.km-theme .km-btn-primary {
    min-height: 42px;
    border-radius: 999px;
    padding: 9px 15px;
    font-weight: 650;
}

.km-theme .lang-switch__btn,
.km-theme .km-btn-secondary {
    color: var(--km-ink);
    border: 1px solid var(--km-border-strong);
    background: transparent;
}

.km-theme .lang-switch__btn:hover,
.km-theme .km-btn-secondary:hover {
    color: var(--km-accent-dark);
    border-color: var(--km-accent);
    background: var(--km-accent-soft);
}

.km-theme .km-btn-primary,
.km-theme .btn-primary {
    color: #fff;
    border: 1px solid var(--km-accent);
    background: var(--km-accent);
    box-shadow: none;
}

.km-theme .km-btn-primary:hover,
.km-theme .btn-primary:hover {
    color: #fff;
    border-color: var(--km-accent-dark);
    background: var(--km-accent-dark);
}

.km-auth-actions { display: flex; gap: 8px; }

.km-page { padding-top: 38px; padding-bottom: 34px; }

.km-notice {
    display: flex;
    min-height: 58px;
    margin-bottom: 20px;
    padding: 13px 18px;
    align-items: center;
    gap: 13px;
    border: 1px solid var(--km-border);
    border-radius: var(--km-radius-md);
    background: rgba(255, 253, 249, 0.8);
}

.km-notice__icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 50%;
    color: var(--km-accent);
    background: var(--km-accent-soft);
}

.km-notice__content {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 12px;
    color: var(--km-muted);
    font-size: 0.88rem;
}

.km-notice__content strong { color: var(--km-ink); white-space: nowrap; }
.km-notice__content p { margin: 0; }

.km-store-layout {
    display: grid;
    grid-template-columns: minmax(250px, 0.31fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.km-category-card,
.km-catalog-card {
    border: 1px solid var(--km-border);
    border-radius: var(--km-radius-lg);
    background: var(--km-surface);
    box-shadow: var(--km-shadow);
}

.km-category-card {
    position: sticky;
    top: 112px;
    padding: 28px 18px 18px;
}

.km-catalog-card { padding: 30px; }

.km-section-heading { padding: 0 8px; }

.km-eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--km-accent);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.km-section-heading h1,
.km-section-heading h2 {
    margin: 0;
    color: var(--km-ink);
    font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.km-section-heading h1 { font-size: clamp(1.7rem, 2vw, 2.2rem); }
.km-section-heading h2 { font-size: clamp(1.9rem, 2.7vw, 2.7rem); }
.km-section-heading p { margin: 9px 0 0; color: var(--km-muted); font-size: 0.9rem; }

.km-category-list {
    display: flex;
    margin-top: 22px;
    flex-direction: column;
    gap: 7px;
}

.km-category-item {
    display: flex;
    min-height: 54px;
    padding: 8px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--km-muted);
    text-decoration: none;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.km-category-item:hover {
    color: var(--km-ink);
    border-color: var(--km-border);
    background: #fbf6ef;
    transform: translateX(2px);
}

.km-category-item.is-primary {
    color: var(--km-accent-dark);
    border-color: #e7c9b4;
    background: var(--km-accent-soft);
}

.km-category-item__main { display: flex; min-width: 0; align-items: center; gap: 11px; font-weight: 650; }

.km-category-item__icon,
.km-category-item__icon-font {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: 1px solid var(--km-border);
    border-radius: 50%;
    background: #fff;
    object-fit: cover;
}

.km-category-item__icon-font {
    display: grid;
    place-items: center;
    color: var(--km-accent);
    line-height: 30px;
    text-align: center;
}

.km-category-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.km-category-item__arrow { font-size: .72rem; opacity: .55; }

.km-category-card__note {
    display: flex;
    margin-top: 22px;
    padding: 14px 12px 2px;
    gap: 10px;
    border-top: 1px solid var(--km-border);
    color: var(--km-muted);
    font-size: 0.76rem;
    line-height: 1.55;
}

.km-category-card__note i { margin-top: 3px; color: var(--km-success); }

.km-catalog-header {
    display: flex;
    margin-bottom: 26px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.km-search {
    display: flex;
    width: min(390px, 46%);
    min-height: 48px;
    padding: 5px 5px 5px 16px;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--km-border-strong);
    border-radius: 999px;
    background: var(--km-surface-strong);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.km-search:focus-within {
    border-color: var(--km-accent);
    box-shadow: 0 0 0 4px rgba(168, 78, 28, .1);
}

.km-search > i { color: var(--km-muted); }

.km-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--km-ink);
    background: transparent;
    font-size: .88rem;
}

.km-search input::placeholder { color: #a39a91; }

.km-search-button {
    min-width: 66px;
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: var(--km-accent);
    font-size: .82rem;
    font-weight: 700;
}

.km-search-button:hover { background: var(--km-accent-dark); }

.km-product-table { overflow: hidden; border: 1px solid var(--km-border); border-radius: 18px; background: #fff; }

.km-product-table__head,
.km-product-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 112px 100px 116px;
    align-items: center;
    column-gap: 18px;
}

.km-product-table__head {
    min-height: 46px;
    padding: 0 18px;
    color: var(--km-muted);
    background: #f5ede3;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.km-product-table__head span:nth-child(n+2) { text-align: center; }

.km-product-row {
    min-height: 102px;
    padding: 14px 18px;
    border-top: 1px solid var(--km-border);
    transition: background-color .18s ease;
}

.km-product-row:hover { background: #fffbf6; }
.km-product-row.is-sold-out { opacity: .62; }

.km-product-main { display: flex; min-width: 0; align-items: center; gap: 14px; }

.km-product-thumb {
    display: block;
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    overflow: hidden;
    border: 1px solid var(--km-border);
    border-radius: 50%;
    background: var(--km-accent-soft);
}

.km-product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.km-product-copy { min-width: 0; }

.km-product-name {
    display: block;
    overflow: hidden;
    color: var(--km-ink);
    font-size: .98rem;
    font-weight: 720;
    line-height: 1.45;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.km-product-name:hover { color: var(--km-accent); }
.km-product-tags { display: flex; margin-top: 7px; flex-wrap: wrap; gap: 5px; }

.km-tag {
    display: inline-flex;
    min-height: 22px;
    padding: 3px 8px;
    align-items: center;
    border-radius: 999px;
    color: var(--km-accent-dark);
    background: var(--km-accent-soft);
    font-size: .66rem;
    font-weight: 700;
    line-height: 1;
}

.km-tag--delivery { color: #416c48; background: #e5efe4; }
.km-tag--featured { color: #6b4a13; background: #f5eac8; }

.km-product-price {
    color: var(--km-accent);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.28rem;
    font-weight: 700;
    text-align: center;
}

.km-product-price span { margin-right: 2px; font-family: inherit; font-size: .78rem; }

.km-product-stock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--km-muted);
    font-size: .82rem;
}

.km-stock-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--km-success); box-shadow: 0 0 0 3px #e6eee4; }
.km-product-action { text-align: right; }

.km-theme .km-buy-button {
    display: inline-flex;
    min-width: 104px;
    min-height: 40px;
    padding: 8px 15px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--km-ink);
    border-radius: 999px;
    color: #fff;
    background: var(--km-ink);
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.km-theme .km-buy-button:hover { color: #fff; border-color: var(--km-accent); background: var(--km-accent); transform: translateY(-1px); }
.km-theme .km-buy-button:disabled { cursor: not-allowed; }

.km-loading,
.km-empty {
    display: flex;
    min-height: 230px;
    padding: 30px;
    align-items: center;
    justify-content: center;
    color: var(--km-muted);
}

.km-loading { gap: 10px; }
.km-empty { flex-direction: column; gap: 8px; text-align: center; }
.km-empty > i { margin-bottom: 7px; color: var(--km-accent); font-size: 2rem; }
.km-empty strong { color: var(--km-ink); font-size: 1rem; }
.km-empty span { font-size: .8rem; }

.km-footer {
    display: flex;
    padding: 12px 20px 30px;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #8e8278;
    background: transparent;
    font-size: .68rem;
    letter-spacing: .08em;
}

/* Inner storefront pages inherit the same warm system. */
.km-theme .panel,
.km-theme .acg-card {
    border: 1px solid var(--km-border);
    border-radius: var(--km-radius-lg);
    background: var(--km-surface);
    box-shadow: var(--km-shadow);
}

.km-theme .panel::before { display: none; }
.km-theme .panel-header { border-bottom-color: var(--km-border); }
.km-theme .panel-header .icon { color: var(--km-accent); background: var(--km-accent-soft); }
.km-theme .panel-title { color: var(--km-ink); }
.km-theme .form-control { border-color: var(--km-border-strong); border-radius: 12px; }
.km-theme .form-control:focus { border-color: var(--km-accent); box-shadow: 0 0 0 4px rgba(168, 78, 28, .1); }
.km-theme .sku.is-primary { color: var(--km-accent-dark); border-color: var(--km-accent); background: var(--km-accent-soft); }
.km-theme .item-detail a { color: var(--km-accent); }

@media (max-width: 1199.98px) {
    .km-brand { min-width: auto; margin-right: 18px; }
    .km-brand__tagline { display: none; }
    .km-theme .navbar-acg .nav-link { padding-inline: 11px; }
    .km-catalog-card { padding: 24px; }
    .km-product-table__head,
    .km-product-row { grid-template-columns: minmax(220px, 1fr) 88px 84px 104px; column-gap: 12px; }
}

@media (max-width: 991.98px) {
    .km-theme .km-navbar { top: 10px; margin-top: 10px; }
    .km-navbar__shell { min-height: 64px; padding: 8px 12px 8px 18px; border-radius: 22px; }
    .km-theme .navbar-collapse { order: 5; width: 100%; margin-top: 10px; padding: 8px; border-top: 1px solid var(--km-border); }
    .km-theme .km-nav { padding-top: 4px; }
    .km-theme .navbar-toggler { margin-left: auto; border: 1px solid var(--km-border); border-radius: 12px; }
    .km-theme .lang-switch { order: 3; }
    .km-theme .user-info-box,
    .km-theme .user-login-box { order: 4; }
    .km-auth-actions .km-btn-secondary { display: none; }
    .km-store-layout { grid-template-columns: 1fr; }
    .km-category-card { position: static; padding: 24px; }
    .km-category-list { margin: 18px -4px 0; padding: 0 4px 6px; flex-direction: row; overflow-x: auto; }
    .km-category-item { min-width: max-content; }
    .km-category-item__arrow,
    .km-category-card__note { display: none; }
}

@media (max-width: 767.98px) {
    .km-page { padding-top: 24px; }
    .km-notice { align-items: flex-start; }
    .km-notice__content { flex-direction: column; gap: 3px; }
    .km-catalog-header { align-items: stretch; flex-direction: column; }
    .km-search { width: 100%; }
    .km-product-table__head { display: none; }
    .km-product-row {
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: 0;
        padding: 16px;
        row-gap: 14px;
    }
    .km-product-main { grid-column: 1 / -1; }
    .km-product-price { text-align: left; }
    .km-product-stock { display: none; }
    .km-product-action { grid-column: 2; }
}

@media (max-width: 575.98px) {
    .km-theme .container { width: calc(100% - 20px); padding-inline: 0; }
    .km-theme .navbar-acg .km-brand { width: 128px; flex: 0 0 128px; overflow: visible; }
    .km-theme .navbar-acg .km-brand > .km-brand__name { max-width: none; overflow: visible; font-size: .92rem; letter-spacing: .07em; text-overflow: clip; }
    .km-theme .lang-switch { display: none; }
    .km-theme .km-btn-primary { min-height: 38px; padding: 7px 11px; }
    .km-category-card,
    .km-catalog-card { border-radius: 19px; }
    .km-category-card { padding: 21px 15px 15px; }
    .km-catalog-card { padding: 21px 15px; }
    .km-section-heading { padding: 0 3px; }
    .km-section-heading h1 { font-size: 1.55rem; }
    .km-section-heading h2 { font-size: 1.75rem; }
    .km-category-list { margin-top: 15px; }
    .km-category-item { min-height: 48px; padding: 7px 10px; }
    .km-category-item__icon,
    .km-category-item__icon-font { width: 29px; height: 29px; flex-basis: 29px; }
    .km-product-thumb { width: 58px; height: 58px; flex-basis: 58px; }
    .km-product-name { font-size: .9rem; }
    .km-buy-button { min-width: 98px; min-height: 38px; }
    .km-footer { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .km-theme *,
    .km-theme *::before,
    .km-theme *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
