:root {
    --brand-red: #8f1d24;
    --brand-red-dark: #661016;
    --brand-gold: #d6a43a;
    --brand-gold-soft: #f8edcf;
    --ink: #17242a;
    --muted: #66747a;
    --line: #dce3e5;
    --line-strong: #c8d2d5;
    --surface: #ffffff;
    --surface-soft: #f7f9f9;
    --surface-warm: #fffaf2;
    --success: #16734c;
    --success-soft: #e8f6ef;
    --error: #b4232c;
    --error-soft: #fff0f1;
    --blue: #2267b5;
    --teal: #0d5b59;
    --mobile-nav-height: 64px;
    --sidebar-width: 272px;
    --radius: 16px;
    --shadow: 0 14px 36px rgba(34, 44, 48, .09);
    --shadow-soft: 0 5px 18px rgba(34, 44, 48, .07);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; color-scheme: light; background: var(--surface-soft); }
body {
    margin: 0;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    color: var(--ink);
    background: var(--surface-soft);
    font-family: Inter, "Noto Sans Khmer", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
body.drawer-open { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--brand-red); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
    outline: 3px solid rgba(214, 164, 58, .38);
    outline-offset: 2px;
}
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.25; }
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.ui-icon { width: 22px; height: 22px; flex: 0 0 auto; }
.brand-logo { display: inline-flex; align-items: center; min-width: 0; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.brand-logo > span { color: var(--brand-red); font-weight: 800; letter-spacing: .02em; }
.eyebrow { margin-bottom: 6px; color: var(--brand-red); font-size: 12px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.phase-chip, .phase-chip-small {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: var(--brand-gold-soft);
    color: #765615;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    padding: 5px 8px;
    white-space: nowrap;
}

/* Shared controls */
.btn {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-weight: 750;
    line-height: 1.2;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand-red), var(--brand-red-dark)); color: #fff; box-shadow: 0 8px 18px rgba(143, 29, 36, .18); }
.btn-primary:hover { color: #fff; background: linear-gradient(135deg, #a2242c, #74151b); }
.btn-danger { border-color: #e5b5b9; background: var(--error-soft); color: var(--error); }
.btn-danger:hover { border-color: var(--error); color: #8a1720; }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand-red); color: var(--brand-red); }
.btn-small { min-height: 36px; padding: 7px 11px; font-size: 13px; }
.btn-small .ui-icon { width: 17px; height: 17px; }
.btn-block { width: 100%; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.alert {
    max-width: 1460px;
    margin: 14px auto;
    border: 1px solid;
    border-radius: 11px;
    padding: 12px 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { border-color: #b8dfcc; background: var(--success-soft); color: #0b5a3a; }
.alert-error { border-color: #f0c1c4; background: var(--error-soft); color: #8a1720; }
.validation-summary ul { margin: 0; padding-left: 20px; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-active { color: #0e6944; background: var(--success-soft); }
.status-inactive { color: #8a3035; background: var(--error-soft); }
.status-submitted, .status-ready, .status-running { color: #765615; background: var(--brand-gold-soft); }
.status-reviewing { color: #205f9f; background: #eaf3ff; }
.status-approved, .status-success, .status-completed { color: #0e6944; background: var(--success-soft); }
.status-rejected, .status-invalid, .status-failed, .status-rollback { color: #8a3035; background: var(--error-soft); }
.form-field { display: grid; gap: 7px; min-width: 0; color: var(--ink); font-weight: 650; }
.form-field > span:first-child { font-size: 13px; }
input, select, textarea {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
}
input::placeholder, textarea::placeholder { color: #95a0a5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-red); box-shadow: 0 0 0 3px rgba(143, 29, 36, .08); outline: 0; }
textarea { min-height: 110px; resize: vertical; }
.stack-form { display: grid; gap: 17px; }
.form-grid-two, .phone-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.phone-fields { grid-template-columns: 130px minmax(0, 1fr); }
.input-with-icon { position: relative; display: block; }
.input-with-icon > .ui-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #7b898f; pointer-events: none; }
.input-with-icon input { padding-left: 46px; padding-right: 46px; }
.password-toggle { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 7px; background: transparent; color: #7b898f; padding: 7px; }
.password-toggle:hover { background: var(--surface-soft); color: var(--brand-red); }
.password-toggle .ui-icon { width: 20px; height: 20px; }
.check-label { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-weight: 500; }
.check-label input, .toggle-row input { width: 20px; height: 20px; min-height: 0; margin: 1px 0 0; accent-color: var(--brand-red); flex: 0 0 auto; }
.form-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13px; }

/* Footer stays in normal document flow */
.site-footer {
    flex: 0 0 auto;
    border-top: 1px solid rgba(200, 210, 213, .88);
    background: #fff;
    color: #58676c;
    font-size: 12px;
}
.footer-main, .footer-bottom { width: 100%; max-width: 1540px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }
.footer-main { padding-top: 22px; padding-bottom: 18px; }
.footer-main nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 26px; }
.footer-main a { color: #34474e; font-weight: 700; }
.footer-bottom { min-height: 48px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 20px; text-align: center; }
.app-download-links { display: flex; gap: 10px; }
.app-download-links a { border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-weight: 700; }
.backend-page .site-footer { margin-left: var(--sidebar-width); }

/* Frontend header */
.site-header { position: sticky; z-index: 90; top: 0; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); }
.site-header__inner { max-width: 1540px; min-height: 82px; margin: 0 auto; padding: 10px 28px; display: grid; grid-template-columns: 235px minmax(280px, 1fr) auto auto; align-items: center; gap: 22px; }
.site-brand .brand-logo { width: 220px; height: 58px; }
.mobile-brand { display: none; }
.header-search { min-width: 0; height: 48px; position: relative; }
.header-search > .ui-icon { position: absolute; z-index: 1; left: 14px; top: 13px; color: #536268; }
.header-search input { height: 48px; padding-left: 46px; padding-right: 80px; background: #fff; }
.header-search .phase-chip { position: absolute; right: 10px; top: 13px; }
.desktop-nav { display: flex; align-items: center; gap: 18px; white-space: nowrap; }
.desktop-nav a, .desktop-nav > span, .desktop-nav summary { min-height: 48px; display: inline-flex; align-items: center; gap: 6px; color: #294148; font-size: 13px; font-weight: 700; position: relative; }
.desktop-nav a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -17px; height: 3px; border-radius: 3px; background: var(--brand-red); }
.desktop-nav .nav-disabled { color: #9aa5a8; cursor: not-allowed; }
.language-switch { min-width: 118px; height: 40px; border: 1px solid var(--line); border-radius: 9px; background: #fff; display: flex; align-items: center; padding: 0 7px; }
.language-switch .ui-icon { width: 18px; height: 18px; color: var(--brand-red); }
.language-switch select { min-height: 36px; border: 0; background: transparent; box-shadow: none; padding: 5px 2px 5px 6px; font-size: 12px; }
.site-main { width: 100%; max-width: 1540px; flex: 1 0 auto; margin: 0 auto; padding: 0 28px 34px; min-width: 0; }
.home-shell { padding: 26px 0 44px; display: grid; gap: 30px; }
.setup-notice { border: 1px solid #efd79d; border-radius: 11px; background: #fff9e9; color: #6f5216; padding: 12px 15px; }
.home-section { min-width: 0; }
.section-heading { min-height: 54px; margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.section-heading h1, .section-heading h2 { margin: 0; color: #28383d; font-size: clamp(23px, 2vw, 31px); }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.section-index { color: #d8dee0; font-size: 34px; font-weight: 900; line-height: 1; }
.empty-state { min-height: 225px; border: 1px dashed #d4dcde; border-radius: var(--radius); background: linear-gradient(135deg, #fff, #fcfaf5); display: flex; align-items: center; justify-content: center; gap: 24px; padding: 32px; text-align: left; }
.empty-state h2, .empty-state h3 { margin-bottom: 7px; font-size: 20px; }
.empty-state p { max-width: 620px; margin: 0; color: var(--muted); }
.empty-state__mark { width: 116px; height: 116px; border-radius: 28px; background: var(--brand-gold-soft); padding: 20px; box-shadow: inset 0 0 0 1px rgba(214, 164, 58, .35); }
.empty-state__mark .brand-logo { width: 100%; height: 100%; opacity: .62; }
.compact-empty { min-height: 150px; justify-content: flex-start; background: #fff; }
.empty-state__icon { width: 72px; height: 72px; border-radius: 20px; background: #f7eded; color: var(--brand-red); display: grid; place-items: center; }
.empty-state__icon .ui-icon { width: 36px; height: 36px; }
.store-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.store-placeholder { min-height: 125px; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 18px; display: grid; grid-template-columns: 72px 1fr; grid-template-rows: 1fr 1fr; gap: 10px 15px; align-items: center; }
.skeleton { display: block; border-radius: 999px; background: linear-gradient(90deg, #eef1f2, #f7f8f8, #eef1f2); background-size: 200% 100%; animation: shimmer 2.2s infinite linear; }
.skeleton-avatar { width: 72px; height: 72px; grid-row: 1 / 3; }
.skeleton-line { width: 88%; height: 12px; }
.skeleton-line.short { width: 58%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.category-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.category-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--shadow-soft); }
.category-card__media { aspect-ratio: 16 / 9; background: #f3f5f5; display: grid; place-items: center; color: var(--brand-red); }
.category-card__media img { width: 100%; height: 100%; object-fit: cover; }
.category-card__media .ui-icon { width: 42px; height: 42px; }
.category-card h3 { margin: 0; padding: 12px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recommendation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.recommendation-grid article { min-height: 130px; border: 1px solid var(--line); border-radius: 14px; background: #fff; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 14px; padding: 18px; }
.recommendation-grid article > span:first-child { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: var(--brand-red); background: #faeeee; }
.recommendation-grid h3 { margin: 0; font-size: 16px; }
.recommendation-grid small { color: #7c5d19; background: var(--brand-gold-soft); border-radius: 999px; padding: 4px 8px; }
.mobile-bottom-nav { display: none; }

/* Authentication */
.auth-page { background: radial-gradient(circle at 12% 20%, #fff2df 0, transparent 33%), radial-gradient(circle at 88% 70%, #f5e9e9 0, transparent 32%), #f8f9f9; }
.auth-topbar { min-height: 78px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 32px; }
.auth-topbar .brand-logo { width: 215px; height: 58px; }
.auth-brand-symbol { display: none; }
.auth-topbar-actions { display: flex; align-items: center; gap: 15px; }
.return-home { min-height: 42px; display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.auth-main { flex: 1 0 auto; min-height: 0; padding-bottom: 30px; }
.auth-main > .alert { max-width: 1100px; }
.auth-split { min-height: calc(100vh - 112px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }
.auth-hero { position: relative; overflow: hidden; min-height: 650px; background: linear-gradient(150deg, #4d0c11, #8f1d24 52%, #ca8e26); color: #fff; padding: clamp(44px, 7vw, 100px); display: flex; align-items: center; }
.auth-hero::after { content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; right: -170px; bottom: -170px; box-shadow: 0 0 0 80px rgba(255,255,255,.04), 0 0 0 160px rgba(255,255,255,.03); }
.auth-hero__content { position: relative; z-index: 2; max-width: 640px; }
.auth-hero .auth-watermark { width: 120px; height: 120px; margin-bottom: 28px; filter: drop-shadow(0 12px 24px rgba(0,0,0,.22)); }
.auth-hero .eyebrow { color: #ffe3a3; }
.auth-hero h1 { margin-bottom: 15px; font-size: clamp(34px, 4.2vw, 65px); }
.auth-hero__content > p:not(.eyebrow) { font-size: clamp(17px, 1.5vw, 24px); opacity: .86; }
.trust-row { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 35px; }
.trust-row span { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.hero-collage { position: absolute; z-index: 1; left: 7%; right: 6%; bottom: 7%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; opacity: .16; }
.hero-collage span { aspect-ratio: 1; border: 1px solid rgba(255,255,255,.6); border-radius: 24px; display: grid; place-items: center; }
.hero-collage .ui-icon { width: 45%; height: 45%; }
.auth-card-wrap { display: grid; place-items: center; padding: 40px clamp(26px, 6vw, 90px); }
.auth-card { width: 100%; max-width: 570px; border: 1px solid rgba(214, 220, 222, .9); border-radius: 22px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); padding: clamp(28px, 4vw, 50px); }
.auth-card > h1 { margin: 10px 0 7px; font-size: 31px; }
.auth-intro { margin-bottom: 28px; color: var(--muted); }
.portal-badge { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; background: var(--brand-gold-soft); color: #755310; font-size: 12px; font-weight: 800; padding: 7px 11px; }
.portal-badge .ui-icon { width: 17px; height: 17px; }
.auth-switch { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; display: flex; justify-content: center; gap: 8px; color: var(--muted); }
.auth-switch a { font-weight: 800; }
.register-shell { max-width: 1180px; margin: 0 auto; padding: 38px 26px 65px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); align-items: center; gap: 34px; }
.register-card { max-width: none; }
.register-benefits { border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.9); box-shadow: var(--shadow-soft); padding: 34px; }
.register-benefits > .brand-logo { width: 92px; height: 92px; margin-bottom: 22px; }
.register-benefits h2 { font-size: 23px; }
.register-benefits > div { border-top: 1px solid var(--line); padding: 18px 0; display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; }
.register-benefits > div span { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #f8eeee; color: var(--brand-red); }
.register-benefits p { margin: 0; color: var(--muted); }
.terms-check { margin: 2px 0; }
.single-auth-shell { min-height: calc(100vh - 114px); padding: 55px 24px 80px; display: grid; place-items: center; }
.narrow-auth-card { max-width: 540px; text-align: center; }
.narrow-auth-card .stack-form { text-align: left; }
.auth-card-icon { width: 70px; height: 70px; margin: 0 auto 18px; border-radius: 20px; background: var(--brand-gold-soft); color: var(--brand-red); display: grid; place-items: center; }
.auth-card-icon .ui-icon { width: 34px; height: 34px; }
.text-back { margin-top: 20px; display: inline-flex; align-items: center; gap: 6px; }
.icon-back { transform: rotate(180deg); }
.admin-login-shell { background: linear-gradient(150deg, #fdf7eb, #f8f9f9 48%, #f4e4e5); }
.admin-login-card { max-width: 510px; }
.admin-login-logo { width: 230px; height: 78px; margin: 0 auto 20px; display: flex; }
.error-logo { width: 80px; height: 80px; margin: 0 auto; }
.error-code { margin: 10px 0 0; color: var(--brand-red); font-size: 58px; font-weight: 900; }

/* Backend fixed desktop sidebar */
.backend-page { background: #f5f7f7; }
.backend-sidebar {
    position: fixed;
    z-index: 160;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    border-right: 1px solid var(--line);
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.sidebar-brand { min-height: 96px; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 15px 20px; position: relative; }
.sidebar-logo-full .brand-logo { width: 218px; height: 66px; }
.sidebar-logo-symbol { display: none; }
.drawer-close { display: none; }
.sidebar-portal-label { padding: 16px 22px 6px; color: #8b979b; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 4px; padding: 8px 13px 18px; }
.sidebar-nav > a, .sidebar-nav > span { min-height: 48px; border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: 23px minmax(0, 1fr) auto; align-items: center; gap: 10px; color: #314249; font-weight: 700; }
.sidebar-nav > a:hover { background: #fbf2f2; color: var(--brand-red); }
.sidebar-nav > a.active { background: linear-gradient(90deg, #faecec, #fff6ea); color: var(--brand-red); box-shadow: inset 4px 0 0 var(--brand-red); }
.sidebar-nav > span.disabled { color: #8f9a9d; cursor: not-allowed; }
.sidebar-nav small { border-radius: 999px; padding: 3px 5px; background: var(--surface-soft); color: #899497; font-size: 8px; }
.sidebar-logout { margin-top: auto; padding: 16px 14px; border-top: 1px solid var(--line); }
.sidebar-logout button { width: 100%; min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: #6f2b30; padding: 10px 12px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.sidebar-logout button:hover { background: var(--error-soft); }
.backend-main { width: auto; min-width: 0; flex: 1 0 auto; margin-left: var(--sidebar-width); padding: 28px 30px 34px; }
.backend-main > .alert { max-width: 1440px; }
.backend-mobile-header, .drawer-overlay { display: none; }
.backend-page-shell { max-width: 1440px; min-width: 0; margin: 0 auto; display: grid; gap: 20px; }
.backend-page-heading { min-height: 75px; display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; }
.backend-page-heading h1 { margin: 0 0 7px; font-size: 31px; }
.backend-page-heading p { margin-bottom: 0; color: var(--muted); }
.breadcrumb-back { margin-bottom: 7px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; }
.merchant-identity { padding: 23px; display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: center; gap: 18px; }
.merchant-avatar { width: 82px; height: 82px; border-radius: 22px; overflow: hidden; background: var(--brand-gold-soft); color: var(--brand-red); display: grid; place-items: center; }
.merchant-avatar img { width: 100%; height: 100%; object-fit: cover; }
.merchant-avatar .ui-icon { width: 38px; height: 38px; }
.merchant-identity h2 { margin: 3px 0 4px; }
.merchant-identity p, .merchant-identity span { margin: 0; color: var(--muted); font-size: 12px; }
.merchant-store-meta { text-align: right; display: grid; gap: 4px; }
.merchant-store-meta strong { color: var(--success); text-transform: uppercase; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-grid article { min-height: 115px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-soft); padding: 20px; display: flex; align-items: center; gap: 16px; }
.metric-icon { width: 58px; height: 58px; flex: 0 0 auto; border-radius: 17px; display: grid; place-items: center; }
.metric-icon.green { color: #16804e; background: #e8f7ef; }
.metric-icon.amber { color: #a6660a; background: #fff2d8; }
.metric-icon.blue { color: #246ab7; background: #eaf3ff; }
.metric-icon.red { color: var(--brand-red); background: #fbeaec; }
.metric-icon .ui-icon { width: 30px; height: 30px; }
.metric-grid article > div { display: grid; gap: 3px; }
.metric-grid strong { font-size: 30px; line-height: 1; }
.metric-grid span:last-child { color: var(--muted); font-size: 12px; }
.admin-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.foundation-panel { min-height: 160px; padding: 26px; display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 24px; }
.foundation-mark { width: 90px; height: 90px; padding: 12px; border-radius: 24px; background: var(--brand-gold-soft); }
.foundation-mark .brand-logo { width: 100%; height: 100%; }
.foundation-panel h2 { margin-bottom: 7px; }
.foundation-panel p { margin-bottom: 5px; color: var(--muted); }
.foundation-panel small { color: #899397; }

/* Category tree */
.tree-panel { min-width: 0; padding: 19px; overflow: hidden; }
.category-tree { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.category-tree .category-tree { margin: 10px 0 0 31px; border-left: 1px solid #d9dfe1; padding-left: 20px; }
.category-tree__node { min-width: 0; position: relative; }
.category-tree__card { min-width: 0; min-height: 82px; border: 1px solid var(--line); border-radius: 12px; background: #fff; display: grid; grid-template-columns: 58px minmax(190px, 1.1fr) minmax(220px, 1.5fr) auto auto; align-items: center; gap: 13px; padding: 11px 13px; }
.category-tree__card:hover { border-color: #c9b789; box-shadow: 0 7px 20px rgba(33,45,49,.07); }
.category-thumb { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: #f6f1e7; color: var(--brand-red); display: grid; place-items: center; }
.category-thumb img { width: 100%; height: 100%; object-fit: cover; }
.category-thumb .ui-icon { width: 28px; height: 28px; }
.category-primary { min-width: 0; display: grid; gap: 5px; }
.category-primary > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.category-primary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-primary code { color: #718087; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-translations { min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.category-translations span { min-width: 0; color: #44565c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.category-translations small { display: inline-flex; margin-right: 5px; color: #9aa4a7; font-size: 8px; font-weight: 800; }
.category-flags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.category-flags span { border-radius: 999px; background: #f0f3f4; color: #647379; padding: 3px 7px; font-size: 9px; font-weight: 800; }
.category-flags .flag-home { background: #e9f5ff; color: #2668a7; }
.category-flags .flag-featured { background: var(--brand-gold-soft); color: #765615; }
.category-actions { display: flex; gap: 7px; }

/* Category form */
.category-form { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 20px; }
.form-main-column { min-width: 0; display: grid; gap: 18px; }
.form-side-column { min-width: 0; }
.form-section { min-width: 0; padding: 22px; }
.form-section-heading { margin-bottom: 19px; display: flex; align-items: center; gap: 12px; }
.form-section-heading > span { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; background: var(--brand-red); color: #fff; display: grid; place-items: center; font-weight: 800; }
.form-section-heading h2 { margin: 0; font-size: 18px; }
.form-section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.translation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.translation-card { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 13px; display: grid; gap: 13px; }
.translation-card legend { padding: 0 7px; color: var(--brand-red); font-size: 11px; font-weight: 800; }
.translation-card textarea { min-height: 100px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.upload-box { min-width: 0; min-height: 245px; border: 1px dashed #bdc9cc; border-radius: 13px; background: #fbfcfc; padding: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; cursor: pointer; }
.upload-box:hover { border-color: var(--brand-red); background: #fffafa; }
.upload-box__title { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.upload-box input[type=file] { width: 1px; height: 1px; min-height: 0; position: absolute; opacity: 0; pointer-events: none; }
.upload-box__action { min-height: 38px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--brand-red); display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; font-size: 12px; font-weight: 750; }
.upload-box__action .ui-icon { width: 17px; height: 17px; }
.upload-box small { color: var(--muted); }
.upload-preview { width: 100%; min-height: 105px; margin-top: auto; border-radius: 9px; overflow: hidden; background: #eef1f2; display: grid; place-items: center; }
.upload-preview:empty::after { content: "Preview"; color: #9aa4a7; font-size: 11px; }
.upload-preview img { width: 100%; height: 125px; object-fit: cover; }
.icon-preview img { object-fit: contain; padding: 17px; }
.sticky-form-panel { position: sticky; top: 20px; display: grid; gap: 15px; }
.toggle-row { min-height: 62px; border: 1px solid var(--line); border-radius: 10px; padding: 11px; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.toggle-row span { display: grid; gap: 2px; }
.toggle-row small { color: var(--muted); }
.category-record-meta { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; display: grid; grid-template-columns: 1fr auto; gap: 6px; color: var(--muted); }
.category-record-meta strong { color: var(--ink); }

/* v1.2 member, merchant, CMS and updater */
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary .ui-icon:last-child { width: 14px; height: 14px; transform: rotate(90deg); }
.user-menu__dropdown { position: absolute; z-index: 120; top: calc(100% + 7px); right: 0; width: 205px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); padding: 8px; display: grid; }
.user-menu__dropdown a, .user-menu__dropdown > span, .user-menu__dropdown button { width: 100%; min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; text-align: left; font-size: 13px; }
.user-menu__dropdown a:hover, .user-menu__dropdown button:hover { background: var(--surface-soft); color: var(--brand-red); }
.content-shell { width: 100%; max-width: 1100px; margin: 0 auto; padding: 34px 0; display: grid; gap: 20px; }
.cms-content { padding: clamp(24px, 5vw, 56px); }
.cms-content h1 { margin-bottom: 28px; font-size: clamp(28px, 4vw, 44px); }
.cms-body { color: #35474e; white-space: normal; line-height: 1.85; }
.account-shell { max-width: 850px; }
.account-card { padding: 28px; display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 20px; align-items: center; }
.account-card h1 { margin: 0 0 6px; }
.account-card p { margin: 2px 0; color: var(--muted); }
.account-avatar { width: 80px; height: 80px; border-radius: 22px; background: var(--brand-gold-soft); color: var(--brand-red); display: grid; place-items: center; }
.account-avatar .ui-icon { width: 40px; height: 40px; }
.account-actions { padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account-actions > span { display: flex; align-items: center; gap: 10px; }
.account-actions small { border-radius: 999px; background: var(--brand-gold-soft); padding: 3px 7px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.page-heading h1 { margin-bottom: 0; }
.merchant-application-shell { max-width: 1040px; }
.application-form { padding: clamp(20px, 4vw, 38px); display: grid; gap: 20px; }
.application-form h2 { margin: 10px 0 0; }
.form-hint, .form-field small { margin: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.application-status-card { min-height: 190px; padding: 30px; display: flex; align-items: center; gap: 22px; }
.application-status-card > .ui-icon { width: 60px; height: 60px; color: var(--brand-red); }
.application-status-card p { color: var(--muted); }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-tabs a { border: 1px solid var(--line); border-radius: 999px; background: #fff; padding: 8px 13px; font-size: 13px; font-weight: 700; }
.filter-tabs a.active { border-color: var(--brand-red); background: #faeeee; color: var(--brand-red); }
.table-panel, .update-section { min-width: 0; padding: 20px; }
.responsive-table { width: 100%; min-width: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: top; }
th { background: var(--surface-soft); color: #53636a; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.empty-cell { padding: 28px; color: var(--muted); text-align: center; }
.table-actions, .update-quick-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.table-actions form, .update-quick-actions form { margin: 0; }
.table-actions details { position: relative; }
.table-actions summary { list-style: none; cursor: pointer; }
.package-detail { position: absolute; z-index: 20; right: 0; top: 42px; width: min(360px, 80vw); border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); padding: 14px; }
.package-detail p { margin: 0; white-space: normal; }
.filename-cell { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.filename-cell small { display: block; color: var(--muted); }
.error-text { display: block; max-width: 360px; margin-top: 5px; color: var(--error); white-space: normal; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-card { padding: 22px; }
.detail-card dl { margin: 0; display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; }
.detail-card dt { color: var(--muted); font-size: 12px; }
.detail-card dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.review-actions { padding: 22px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.reject-form { flex: 1 1 420px; display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 10px; align-items: end; }
.reject-form textarea { min-height: 80px; }
.footer-admin-form { display: grid; gap: 20px; }
.admin-card-list { display: grid; gap: 16px; }
.admin-edit-card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfc; padding: 17px; display: grid; gap: 14px; }
.admin-edit-card > header { display: flex; justify-content: space-between; gap: 15px; }
.sticky-save { position: sticky; z-index: 30; bottom: 12px; display: flex; justify-content: flex-end; pointer-events: none; }
.sticky-save .btn { pointer-events: auto; min-width: 170px; }
.version-badge { border-radius: 999px; background: var(--brand-gold-soft); color: #765615; padding: 8px 13px; font-weight: 850; }
.update-current { padding: 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.update-current > div:first-child { display: grid; }
.update-current strong { font-size: 30px; color: var(--brand-red); }
.section-toolbar { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.section-toolbar h2 { margin-bottom: 4px; }
.section-toolbar p { margin: 0; max-width: 680px; color: var(--muted); overflow-wrap: anywhere; }
.inline-upload { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-upload label { position: relative; }
.inline-upload input[type=file] { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.selected-row { background: #fffbef; }
.backup-card-list { display: grid; gap: 14px; }
.backup-group { border: 1px solid var(--line); border-radius: 13px; padding: 16px; display: grid; gap: 14px; }
.backup-group > header { display: flex; justify-content: space-between; gap: 16px; }
.backup-group > header div { display: grid; }
.backup-group small { color: var(--muted); }
.backup-files { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.backup-files > div { min-width: 0; border-radius: 10px; background: var(--surface-soft); padding: 12px; display: grid; gap: 7px; }
.compact-list { display: grid; gap: 8px; }
.compact-list article { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; }
.progress-modal, .update-prompt { position: fixed; z-index: 500; inset: 0; background: rgba(13, 25, 30, .62); padding: 18px; display: grid; place-items: center; }
.progress-modal[hidden] { display: none; }
.progress-card, .update-prompt__card { width: min(540px, 100%); border-radius: 18px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.28); padding: 28px; text-align: center; }
.progress-track { width: 100%; height: 14px; margin: 22px 0 10px; border-radius: 999px; background: #e8edef; overflow: hidden; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-red), var(--brand-gold)); transition: width .25s ease; }
.progress-card pre { max-height: 180px; overflow: auto; border-radius: 8px; background: var(--error-soft); color: var(--error); padding: 10px; white-space: pre-wrap; text-align: left; }
.update-prompt__card p { color: var(--muted); }
.update-prompt__actions { display: flex; justify-content: center; gap: 10px; }
.update-prompt__actions form { margin: 0; }

/* Responsive */
@media (max-width: 1280px) {
    .site-header__inner { grid-template-columns: 190px minmax(230px, 1fr) auto auto; gap: 14px; padding-left: 20px; padding-right: 20px; }
    .site-brand .brand-logo { width: 180px; }
    .desktop-nav { gap: 11px; }
    .desktop-nav a, .desktop-nav > span { font-size: 12px; }
    .category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .category-tree__card { grid-template-columns: 55px minmax(160px, 1fr) minmax(150px, 1fr) auto; }
    .category-actions { grid-column: 2 / -1; justify-content: flex-end; }
    .translation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1023px) {
    .site-header__inner { min-height: 70px; grid-template-columns: 54px minmax(0, 1fr) auto; padding: 8px 16px; gap: 11px; }
    .desktop-brand, .desktop-nav { display: none; }
    .mobile-brand { display: flex; }
    .mobile-brand .brand-logo { width: 52px; height: 52px; }
    .header-search { height: 44px; }
    .header-search input { height: 44px; min-height: 44px; }
    .header-search > .ui-icon { top: 11px; }
    .header-search .phase-chip { top: 11px; }
    .site-header .language-switch { min-width: 52px; width: 52px; }
    .site-header .language-switch select { width: 23px; color: transparent; }
    .site-main { padding-left: 18px; padding-right: 18px; }
    .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .recommendation-grid { grid-template-columns: 1fr; }
    .auth-split { grid-template-columns: 1fr; }
    .auth-hero { min-height: 310px; padding: 46px 8vw; align-items: flex-start; }
    .auth-hero .auth-watermark { width: 78px; height: 78px; margin-bottom: 14px; }
    .auth-hero h1 { font-size: 34px; }
    .trust-row { margin-top: 20px; }
    .hero-collage { left: auto; right: 4%; width: 36%; bottom: 13%; grid-template-columns: 1fr 1fr; }
    .auth-card-wrap { padding: 34px 20px 65px; }
    .register-shell { grid-template-columns: 1fr; max-width: 760px; }
    .register-benefits { order: -1; }
    .backend-sidebar { width: min(86vw, 320px); bottom: 0; transform: translateX(-105%); transition: transform .23s ease; box-shadow: 15px 0 40px rgba(15,29,34,.18); }
    body.drawer-open .backend-sidebar { transform: translateX(0); }
    .sidebar-logo-full { display: none; }
    .sidebar-logo-symbol { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 850; }
    .sidebar-logo-symbol .brand-logo { width: 54px; height: 54px; }
    .drawer-close { display: grid; place-items: center; position: absolute; right: 12px; top: 27px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); padding: 7px; }
    .drawer-overlay { display: block; position: fixed; z-index: 150; inset: 0; background: rgba(10,20,24,.48); opacity: 0; pointer-events: none; transition: opacity .23s ease; }
    body.drawer-open .drawer-overlay { opacity: 1; pointer-events: auto; }
    .backend-mobile-header { position: fixed; z-index: 120; top: 0; left: 0; right: 0; min-height: 66px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.98); padding: 7px 14px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
    .drawer-open { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--brand-red); display: grid; place-items: center; padding: 8px; }
    .backend-mobile-header > a { display: inline-flex; min-width: 0; align-items: center; gap: 8px; color: var(--ink); }
    .backend-mobile-header > a .brand-logo { width: 47px; height: 47px; }
    .backend-mobile-header > a strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .backend-mobile-header .language-switch { width: 118px; }
    .backend-main { margin-left: 0; padding: 88px 18px 30px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .foundation-panel { grid-template-columns: 72px minmax(0, 1fr); }
    .foundation-mark { width: 70px; height: 70px; border-radius: 19px; }
    .foundation-panel .btn { grid-column: 1 / -1; }
    .category-tree__card { grid-template-columns: 55px minmax(0, 1fr) auto; }
    .category-translations { grid-column: 2 / -1; }
    .category-flags { grid-column: 2; justify-content: flex-start; }
    .category-actions { grid-column: 3; }
    .category-form { grid-template-columns: 1fr; }
    .form-side-column { order: -1; }
    .sticky-form-panel { position: static; }
}

@media (max-width: 767px) {
    :root { --mobile-nav-height: 62px; }
    body.has-mobile-nav .site-main { padding-bottom: 26px; }
    body.has-mobile-nav .site-footer { padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); }
    .site-header__inner { grid-template-columns: 48px minmax(0, 1fr) 46px; padding: 7px 10px; }
    .mobile-brand .brand-logo { width: 46px; height: 46px; }
    .header-search input { padding-right: 38px; font-size: 12px; }
    .header-search .phase-chip { display: none; }
    .site-header .language-switch { min-width: 44px; width: 44px; padding: 0 5px; }
    .site-header .language-switch select { width: 18px; padding: 0; }
    .site-main { padding-left: 12px; padding-right: 12px; }
    .home-shell { padding-top: 18px; gap: 25px; }
    .section-heading { align-items: flex-start; }
    .section-heading h1, .section-heading h2 { font-size: 21px; }
    .section-index { font-size: 26px; }
    .empty-state { min-height: 210px; flex-direction: column; text-align: center; padding: 24px 18px; }
    .empty-state__mark { width: 88px; height: 88px; border-radius: 22px; padding: 15px; }
    .compact-empty { min-height: 170px; justify-content: center; }
    .store-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .store-placeholder { min-height: 105px; grid-template-columns: 48px 1fr; padding: 12px; gap: 8px; }
    .skeleton-avatar { width: 48px; height: 48px; }
    .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .category-card h3 { padding: 10px; font-size: 12px; }
    .recommendation-grid { gap: 9px; }
    .recommendation-grid article { min-height: 100px; grid-template-columns: 44px 1fr auto; padding: 13px; }
    .recommendation-grid article > span:first-child { width: 44px; height: 44px; border-radius: 13px; }
    .recommendation-grid h3 { font-size: 13px; }
    .mobile-bottom-nav { position: fixed; z-index: 190; left: 0; right: 0; bottom: 0; height: var(--mobile-nav-height); border-top: 1px solid var(--line); background: rgba(255,255,255,.98); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); }
    .mobile-bottom-nav a, .mobile-bottom-nav > span { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #69777c; font-size: 10px; }
    .mobile-bottom-nav .ui-icon { width: 21px; height: 21px; }
    .mobile-bottom-nav .active { color: var(--brand-red); }
    .auth-topbar { min-height: 66px; padding: 7px 12px; }
    .auth-brand-full { display: none; }
    .auth-brand-symbol { display: inline-flex; }
    .auth-brand-symbol .brand-logo { width: 50px; height: 50px; }
    .auth-topbar-actions { gap: 6px; }
    .auth-topbar .language-switch { width: 106px; min-width: 106px; }
    .return-home { width: 42px; height: 42px; justify-content: center; }
    .return-home span { display: none; }
    .auth-split { display: block; }
    .auth-hero { min-height: 230px; padding: 28px 22px; }
    .auth-hero .auth-watermark { width: 56px; height: 56px; margin-bottom: 8px; }
    .auth-hero h1 { font-size: 27px; }
    .auth-hero__content > p:not(.eyebrow) { font-size: 14px; }
    .trust-row { margin-top: 15px; gap: 8px 12px; }
    .trust-row span { font-size: 10px; }
    .hero-collage { display: none; }
    .auth-card-wrap { padding: 18px 12px 62px; }
    .auth-card { border-radius: 16px; padding: 24px 18px; }
    .auth-card > h1 { font-size: 26px; }
    .form-grid-two { grid-template-columns: 1fr; }
    .phone-fields { grid-template-columns: 105px minmax(0, 1fr); }
    .form-between { align-items: flex-start; }
    .register-shell { padding: 18px 12px 65px; gap: 17px; }
    .register-benefits { padding: 22px 18px; }
    .register-benefits > .brand-logo { width: 65px; height: 65px; }
    .register-benefits h2 { font-size: 18px; }
    .register-benefits > div { padding: 13px 0; }
    .single-auth-shell { padding: 24px 12px 65px; }
    .backend-mobile-header { grid-template-columns: 42px minmax(0, 1fr) 48px; padding-left: 10px; padding-right: 10px; }
    .backend-mobile-header .language-switch { width: 46px; min-width: 46px; }
    .backend-mobile-header .language-switch select { width: 18px; color: transparent; }
    .backend-main { padding: 82px 12px 24px; }
    .backend-page .site-footer { margin-left: 0; }
    .backend-page-heading { min-height: 0; flex-direction: column; gap: 14px; }
    .backend-page-heading h1 { font-size: 25px; }
    .backend-page-heading > .btn { width: 100%; }
    .merchant-identity { grid-template-columns: 64px minmax(0, 1fr); padding: 16px; }
    .merchant-avatar { width: 64px; height: 64px; border-radius: 17px; }
    .merchant-store-meta { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; text-align: left; grid-template-columns: 1fr auto; }
    .metric-grid, .admin-metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
    .metric-grid article { min-height: 100px; padding: 13px; gap: 10px; }
    .metric-icon { width: 44px; height: 44px; border-radius: 13px; }
    .metric-icon .ui-icon { width: 23px; height: 23px; }
    .metric-grid strong { font-size: 24px; }
    .foundation-panel { grid-template-columns: 56px minmax(0, 1fr); padding: 17px; gap: 13px; }
    .foundation-mark { width: 56px; height: 56px; border-radius: 16px; padding: 8px; }
    .foundation-panel h2 { font-size: 17px; }
    .tree-panel { padding: 10px; overflow: visible; }
    .category-tree { gap: 8px; }
    .category-tree .category-tree { margin-left: 15px; padding-left: 9px; }
    .category-tree__card { grid-template-columns: 46px minmax(0, 1fr); gap: 9px; padding: 10px; }
    .category-thumb { width: 46px; height: 46px; }
    .category-primary { grid-column: 2; }
    .category-translations { grid-column: 1 / -1; grid-template-columns: 1fr; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
    .category-flags { grid-column: 1 / -1; justify-content: flex-start; }
    .category-actions { grid-column: 1 / -1; justify-content: stretch; }
    .category-actions .btn { flex: 1 1 0; }
    .form-section { padding: 16px 13px; }
    .form-grid-two { grid-template-columns: 1fr; }
    .upload-grid { grid-template-columns: 1fr; }
    .upload-box { min-height: 220px; }
    .footer-main, .footer-bottom { padding-left: 14px; padding-right: 14px; }
    .footer-main nav { gap: 10px 16px; }
    .footer-bottom { min-height: 58px; flex-direction: column; gap: 5px; padding-top: 10px; padding-bottom: 10px; }
    .content-shell { padding: 22px 0; }
    .account-card { grid-template-columns: 62px minmax(0, 1fr); padding: 18px; }
    .account-avatar { width: 62px; height: 62px; border-radius: 17px; }
    .account-actions, .page-heading, .section-toolbar, .update-current, .backup-group > header { align-items: stretch; flex-direction: column; }
    .application-status-card { padding: 20px; flex-direction: column; align-items: flex-start; }
    .filter-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; }
    .filter-tabs a { flex: 0 0 auto; }
    .responsive-table table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
    .responsive-table thead { display: none; }
    .responsive-table tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 8px; }
    .responsive-table td { border-bottom: 1px solid var(--line); padding: 8px; }
    .responsive-table td:last-child { border-bottom: 0; }
    .responsive-table td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
    .detail-grid, .backup-files { grid-template-columns: 1fr; }
    .detail-card dl { grid-template-columns: 1fr; gap: 4px; }
    .detail-card dd { margin-bottom: 10px; }
    .reject-form { grid-template-columns: 1fr; }
    .translation-grid { grid-template-columns: 1fr; }
    .inline-upload { width: 100%; }
    .inline-upload .btn { flex: 1 1 0; }
    .compact-list article { grid-template-columns: 1fr auto; }
    .compact-list article form { grid-column: 1 / -1; }
    .compact-list article .btn { width: 100%; }
    .progress-card, .update-prompt__card { padding: 22px 16px; }
}

@media (max-width: 390px) {
    .header-search input { font-size: 11px; padding-left: 39px; }
    .header-search > .ui-icon { left: 10px; }
    .site-footer { font-size: 10px; }
    .metric-grid article { flex-direction: column; align-items: flex-start; }
    .metric-grid strong { font-size: 22px; }
    .auth-topbar .language-switch { width: 94px; min-width: 94px; }
}

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

/* v1.3 commerce, member center, messaging, verification and lottery */
.nav-badge, .unread-badge { min-width: 19px; height: 19px; border-radius: 999px; background: var(--brand-red); color: #fff; padding: 0 5px; display: inline-grid; place-items: center; font-size: 10px; font-weight: 850; line-height: 1; }
.desktop-nav a, .mobile-bottom-nav a, .sidebar-nav a { position: relative; }
.desktop-nav .nav-badge { position: absolute; top: -7px; right: -10px; }
.mobile-bottom-nav .nav-badge { position: absolute; top: 5px; left: calc(50% + 7px); }
.sidebar-nav .nav-badge { margin-left: auto; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 0; }
.panel-heading a { color: var(--brand-red); font-weight: 750; }
.breadcrumbs { min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.breadcrumbs a { color: var(--brand-red); }
.catalog-shell, .product-detail-shell, .store-page-shell, .member-center-shell, .wallet-shell, .lottery-shell, .messages-list-shell, .cart-shell, .account-edit-shell { max-width: 1180px; }
.catalog-search { padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.catalog-search .form-field { margin: 0; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 6px 22px rgba(20,34,39,.06); }
.product-card__media { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #f4f6f6; }
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.product-card:hover .product-card__media img { transform: scale(1.025); }
.product-card__body { min-width: 0; padding: 15px; display: grid; gap: 8px; }
.product-card__body h3 { min-width: 0; margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.product-card__body > strong { color: var(--brand-red); font-size: 19px; }
.product-card__store { min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.product-card__store .ui-icon { flex: 0 0 auto; width: 15px; height: 15px; }
.product-detail-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr); gap: 22px; align-items: start; }
.product-gallery, .product-buybox, .product-copy { padding: clamp(18px, 3vw, 28px); }
.product-main-image { overflow: hidden; aspect-ratio: 4 / 3; border-radius: 12px; background: #f4f6f6; }
.product-main-image img { width: 100%; height: 100%; object-fit: contain; }
.product-thumbnails { margin-top: 10px; display: flex; gap: 8px; overflow-x: auto; }
.product-thumbnails img { flex: 0 0 72px; width: 72px; height: 72px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; }
.product-buybox { display: grid; gap: 17px; }
.product-buybox h1 { margin: 0; font-size: clamp(25px, 3vw, 37px); overflow-wrap: anywhere; }
.sample-label { justify-self: start; border-radius: 999px; background: var(--brand-gold-soft); color: #71551a; padding: 5px 10px; font-size: 11px; font-weight: 850; }
.product-price { margin: 0; color: var(--brand-red); font-size: clamp(26px, 3vw, 38px); font-weight: 900; }
.store-link { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 11px; }
.store-link > .ui-icon { width: 28px; height: 28px; color: var(--brand-red); }
.store-link span { display: grid; gap: 2px; }
.store-link small { color: var(--muted); }
.product-facts { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.product-facts div { min-width: 0; border-radius: 9px; background: var(--surface-soft); padding: 10px; }
.product-facts dt { color: var(--muted); font-size: 11px; }
.product-facts dd { margin: 4px 0 0; font-weight: 800; overflow-wrap: anywhere; }
.product-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.product-actions form { min-width: 0; margin: 0; }
.product-actions .btn { width: 100%; }
.product-actions #cart-form { grid-column: 1 / -1; display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 9px; }
.product-copy { display: grid; gap: 10px; }
.product-copy h2 { margin: 5px 0 0; }
.rich-copy { color: #45555b; line-height: 1.8; overflow-wrap: anywhere; }
.store-hero { padding: clamp(22px, 4vw, 38px); display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 22px; }
.store-hero__logo, .store-card__logo { border-radius: 24px; background: var(--brand-gold-soft); color: var(--brand-red); display: grid; place-items: center; }
.store-hero__logo { width: 92px; height: 92px; }
.store-hero__logo .ui-icon { width: 46px; height: 46px; }
.store-hero h1 { margin: 0; }
.store-hero p { color: var(--muted); }

.member-profile-card { padding: clamp(20px, 4vw, 32px); display: grid; grid-template-columns: 94px minmax(0, 1fr) auto; align-items: center; gap: 20px; }
.member-avatar, .profile-avatar-large { display: block; border-radius: 26px; background: var(--surface-soft); object-fit: cover; }
.member-avatar { width: 94px; height: 94px; }
.profile-avatar-large { width: 128px; height: 128px; }
.member-profile-card h1 { margin: 0; }
.member-username { margin: 4px 0; color: var(--muted); font-weight: 750; }
.member-verification { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 7px; }
.member-verification span { border-radius: 999px; background: var(--surface-soft); padding: 5px 9px; color: #56666c; font-size: 11px; }
.member-shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.member-shortcuts a { min-height: 106px; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 16px; display: grid; align-content: center; justify-items: center; gap: 9px; text-align: center; font-weight: 800; }
.member-shortcuts .ui-icon { width: 27px; height: 27px; color: var(--brand-red); }
.order-status-panel { padding: 22px; }
.order-status-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.order-status-grid a { border-radius: 11px; background: var(--surface-soft); padding: 14px 8px; display: grid; gap: 5px; text-align: center; }
.order-status-grid span { color: var(--brand-red); font-size: 22px; font-weight: 900; }
.order-status-grid strong { font-size: 12px; }
.account-service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.account-service-grid > a, .service-form-link > button { min-width: 0; padding: 18px; display: grid; grid-template-columns: 30px minmax(0, 1fr) 20px; align-items: center; gap: 11px; text-align: left; }
.account-service-grid .ui-icon { color: var(--brand-red); }
.account-service-grid span { min-width: 0; display: grid; gap: 3px; }
.account-service-grid small { color: var(--muted); font-weight: 500; }
.service-form-link { margin: 0; padding: 0; }
.service-form-link > button { width: 100%; border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.account-logout { display: flex; justify-content: flex-end; }
.account-edit-shell .detail-grid > section { padding: 22px; }
.avatar-upload-form { margin-top: 16px; display: grid; gap: 12px; }
.verification-line { display: flex; justify-content: flex-end; margin: -5px 0 6px; }
.verification-actions { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-wrap: wrap; gap: 9px; }
.verification-actions form { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.address-grid, .coupon-grid, .lottery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.address-card, .coupon-card, .lottery-card { min-width: 0; padding: 19px; display: grid; gap: 10px; }
.address-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.address-card p, .address-card small { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.address-card footer { display: flex; flex-wrap: wrap; gap: 7px; }
.address-card footer form { margin: 0; }
.address-form, .settings-form, .product-form, .admin-form { min-width: 0; padding: clamp(18px, 3vw, 28px); display: grid; gap: 18px; }
.coupon-card header, .coupon-card footer { display: flex; justify-content: space-between; gap: 10px; }
.wallet-balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wallet-balance { border-radius: 16px; padding: 25px; display: grid; gap: 8px; color: #fff; }
.wallet-balance.available { background: linear-gradient(135deg, #8c1f2c, #bd3a48); }
.wallet-balance.frozen { background: linear-gradient(135deg, #41525a, #697b83); }
.wallet-balance strong { font-size: clamp(27px, 4vw, 39px); }
.wallet-shell > .panel { padding: 22px; }
.order-list { display: grid; gap: 10px; }
.order-card { padding: 17px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; }
.order-card > div { display: grid; gap: 3px; }
.order-card small { color: var(--muted); }
.filter-tabs { scrollbar-width: thin; }

.conversation-list { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.conversation-list > a { min-width: 0; border-bottom: 1px solid var(--line); padding: 15px 17px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.conversation-list > a:last-child { border-bottom: 0; }
.conversation-list > a:hover { background: #fffaf0; }
.conversation-avatar { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-gold-soft); color: var(--brand-red); display: grid; place-items: center; }
.conversation-avatar .ui-icon { width: 24px; height: 24px; }
.conversation-summary { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; }
.conversation-summary strong, .conversation-summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-summary small { color: var(--muted); }
.conversation-summary time { grid-column: 2; grid-row: 1; color: var(--muted); font-size: 10px; }
.message-filter-summary { margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 7px; }
.message-filter-summary span { border-radius: 999px; background: var(--surface-soft); padding: 6px 10px; font-size: 11px; font-weight: 750; }
.chat-page-shell { max-width: 980px; margin: 0 auto; }
.conversation-shell { min-width: 0; min-height: min(710px, calc(100dvh - 160px)); overflow: hidden; display: grid; grid-template-rows: auto auto minmax(260px, 1fr) auto; }
.conversation-header { grid-row: 1; border-bottom: 1px solid var(--line); padding: 14px 18px; display: grid; gap: 11px; }
.conversation-header > div { min-width: 0; display: flex; align-items: center; gap: 12px; }
.conversation-header img, .conversation-header > div > span { flex: 0 0 58px; width: 58px; height: 58px; border-radius: 12px; background: var(--surface-soft); object-fit: cover; display: grid; place-items: center; color: var(--brand-red); }
.conversation-header h1 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.conversation-header p { margin: 3px 0; color: var(--muted); font-size: 12px; }
.conversation-header a:not(.breadcrumb-back) { color: var(--brand-red); font-size: 12px; font-weight: 750; }
.conversation-intervention { grid-row: 2; min-height: 0; padding: 7px 18px; border-bottom: 1px solid var(--line); background: #fffaf0; display: flex; justify-content: flex-end; }
.conversation-intervention form { margin: 0; }
.message-thread { grid-row: 3; min-height: 0; max-height: calc(100dvh - 300px); overflow-y: auto; overscroll-behavior: contain; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: #f6f8f8; scroll-behavior: smooth; }
.message-bubble { align-self: flex-start; max-width: min(76%, 620px); border: 1px solid var(--line); border-radius: 5px 16px 16px; background: #fff; padding: 10px 12px; box-shadow: 0 3px 10px rgba(20,35,40,.05); overflow-wrap: anywhere; }
.message-bubble.mine { align-self: flex-end; border-color: #efd6a0; border-radius: 16px 5px 16px 16px; background: #fff8e8; }
.message-bubble small, .message-bubble time { display: block; color: var(--muted); font-size: 9px; }
.message-bubble p { margin: 5px 0; line-height: 1.6; }
.message-bubble time { margin-top: 5px; text-align: right; }
.message-image { display: block; margin-top: 7px; }
.message-image img { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; object-fit: contain; }
.message-composer { grid-row: 4; position: sticky; z-index: 20; bottom: 0; margin: 0; border-top: 1px solid var(--line); background: #fff; padding: 10px; display: flex; align-items: flex-end; gap: 8px; }
.message-composer textarea { flex: 1 1 auto; min-width: 0; min-height: 44px; max-height: 128px; resize: none; }
.message-attach { flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; color: var(--brand-red); display: grid; place-items: center; cursor: pointer; }
.message-attach input, .document-upload-actions input, .avatar-upload-form input[type=file] { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.message-attach .ui-icon { width: 22px; height: 22px; }
.message-composer .btn { min-height: 44px; }

.verification-summary, .verification-review { padding: 20px; }
.document-list, .document-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.document-list a, .document-review-grid a { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.document-list a > span, .document-preview-placeholder { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-soft); color: var(--brand-red); display: grid; place-items: center; }
.document-review-grid a { grid-template-columns: 54px minmax(0, 1fr); }
.document-review-grid .document-preview-placeholder { grid-row: 1 / span 3; width: 54px; height: 54px; }
.document-review-grid em { color: var(--brand-red); font-size: 11px; font-style: normal; }
.verification-upload { border: 1px solid var(--line); border-radius: 13px; background: #fbfcfc; padding: 18px; display: grid; gap: 12px; }
.verification-upload h2 { margin: 0; }
.document-type-options, .document-upload-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.document-type-options label { border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.document-upload-actions label { position: relative; }
.upload-mobile { display: none; }
.secure-image-preview { max-width: min(100%, 460px); max-height: 340px; border: 1px solid var(--line); border-radius: 12px; background: #fff; object-fit: contain; overflow: hidden; }
.secure-image-preview:empty { display: none; }
.secure-image-preview img { display: block; width: 100%; max-height: 340px; object-fit: contain; }
.translation-fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 13px; padding: 15px; display: grid; gap: 12px; }
.translation-fieldset legend { padding: 0 8px; color: var(--brand-red); font-weight: 850; }

.settings-page { max-width: 1180px; margin: 0 auto; }
.settings-tabs { margin-bottom: 17px; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: thin; }
.settings-tabs a { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: #fff; padding: 9px 14px; font-size: 12px; font-weight: 800; }
.settings-tabs a.active { border-color: var(--brand-red); background: #faeeee; color: var(--brand-red); }
.settings-form { max-width: 980px; }
.settings-number-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.switch-field { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); padding: 13px; display: flex; align-items: center; gap: 10px; font-weight: 800; }
.switch-field input { width: 20px; height: 20px; min-height: 0; }
.smtp-test-form { border-top: 1px solid var(--line); padding-top: 17px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; }
.smtp-test-form .form-field { margin: 0; }
.sidebar-group-label { margin: 14px 13px 5px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-inline-form { margin: 0; }
.sidebar-inline-form button { width: 100%; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }

.lottery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lottery-card h2 { margin: 0; overflow-wrap: anywhere; }
.lottery-card dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lottery-card dl div { border-radius: 9px; background: var(--surface-soft); padding: 9px; }
.lottery-card dt { color: var(--muted); font-size: 10px; }
.lottery-card dd { margin: 2px 0 0; font-size: 20px; font-weight: 900; }
.prize-list, .winner-list, .draw-number-list { display: grid; gap: 8px; }
.prize-list > *, .winner-list > *, .draw-number-list > * { border: 1px solid var(--line); border-radius: 10px; padding: 11px; }
.table-product-image { width: 56px; height: 46px; border-radius: 7px; object-fit: cover; background: var(--surface-soft); }
.cart-list { display: grid; gap: 11px; }
.cart-item { padding: 14px; display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.cart-item img { width: 88px; height: 72px; border-radius: 9px; object-fit: cover; }
.cart-item > div { min-width: 0; display: grid; gap: 5px; }
.cart-item h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.cart-total { padding: 20px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; font-size: 20px; }

.home-latest-products .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.product-card__price { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; color: var(--brand-red); }
.product-card__price del { color: var(--muted); font-size: 12px; }
.product-card__price strong { font-size: 19px; overflow-wrap: anywhere; }
.product-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.product-price del { color: var(--muted); font-size: .55em; font-weight: 650; }
.product-thumbnails button { flex: 0 0 74px; width: 74px; height: 74px; border: 2px solid transparent; border-radius: 10px; background: transparent; padding: 0; overflow: hidden; cursor: pointer; }
.product-thumbnails button.active { border-color: var(--brand-red); }
.product-thumbnails button img { display: block; width: 100%; height: 100%; border: 0; border-radius: 7px; object-fit: cover; }
.rich-copy img, .rich-content img, .cms-body img { max-width: 100%; height: auto; }
.rich-copy, .rich-content, .cms-body { min-width: 0; overflow-wrap: anywhere; overflow-x: hidden; }

.store-hero__logo { overflow: hidden; }
.store-hero__logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.store-image-preview { display: block; width: min(100%, 640px); max-height: 420px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); object-fit: contain; }
.store-image-editor { display: grid; gap: 14px; }
.input-prefix { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.input-prefix > span { padding-left: 12px; color: var(--muted); }
.input-prefix input { border: 0; }

.form-section { min-width: 0; display: grid; gap: 14px; }
.form-section > h2 { margin: 0; }
.product-image-list { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.product-image-item { min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 9px; display: grid; gap: 8px; transition: opacity .15s ease, border-color .15s ease; }
.product-image-item.dragging { opacity: .45; }
.product-image-item.marked-delete { opacity: .5; border-color: #be3947; background: #fff3f4; }
.product-image-item > img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 9px; background: var(--surface-soft); object-fit: contain; }
.product-image-item > strong { min-width: 0; color: var(--brand-red); font-size: 12px; overflow-wrap: anywhere; }
.product-image-item > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.drag-handle { margin-left: auto; cursor: grab; color: var(--muted); font-weight: 900; }
.new-image-preview-grid { min-width: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.new-image-preview-grid:empty { display: none; }
.new-image-preview-grid img { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); object-fit: contain; }

.language-tab-list, .language-tabs { min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.language-tab-list button, .language-tabs button { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: inherit; padding: 9px 14px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 850; }
.language-tab-list button.active, .language-tabs button.active { border-color: var(--brand-red); background: #faeeee; color: var(--brand-red); }
.language-tab-panel, .language-panel { min-width: 0; display: grid; gap: 13px; }
.language-tab-panel[hidden], .language-panel[hidden] { display: none; }
.cms-editor-card { gap: 16px; }

.rich-editor { min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: #fff; overflow: hidden; }
.rich-editor__toolbar { min-width: 0; border-bottom: 1px solid var(--line); background: var(--surface-soft); padding: 7px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.rich-editor__toolbar button, .rich-editor__toolbar select { min-height: 34px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: inherit; padding: 5px 8px; font: inherit; font-size: 11px; cursor: pointer; }
.rich-editor__toolbar button { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; }
.rich-editor__toolbar .ui-icon { width: 16px; height: 16px; }
.rich-color { min-height: 34px; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 3px 6px; display: inline-flex; align-items: center; gap: 5px; font-size: 10px; }
.rich-color input { width: 26px; height: 26px; min-height: 0; border: 0; background: transparent; padding: 0; }
.rich-editor__surface { min-width: 0; min-height: 240px; max-height: 680px; overflow: auto; padding: 16px; line-height: 1.7; outline: 0; overflow-wrap: anywhere; }
.rich-editor__surface:focus { box-shadow: inset 0 0 0 2px rgba(143, 28, 42, .15); }
.rich-editor__surface img { max-width: 100%; height: auto; }

.email-template-test { margin-top: 16px; }
.email-template-test h2, .email-template-test p { margin: 0; }
.choice-group { min-width: 0; border: 1px solid var(--line); border-radius: 11px; padding: 11px; display: flex; flex-wrap: wrap; gap: 10px; }
.choice-group legend { padding: 0 6px; font-weight: 800; }
.choice-group label { display: inline-flex; align-items: center; gap: 6px; }
.choice-group input { min-height: 0; }
.order-actions { padding: 20px; }
.order-actions .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.order-actions form { margin: 0; }
.responsive-table td small { display: block; margin-top: 3px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) {
    .merchant-product-row { cursor: pointer; transition: background-color .15s ease, box-shadow .15s ease; }
    .merchant-product-row:hover { background: #fffaf0; box-shadow: inset 3px 0 0 var(--brand-red); }
    .merchant-product-row :is(a,button,input,select,textarea,label,[role="button"]) { cursor: auto; }
    .merchant-product-row :is(a,button,label,[role="button"]) { cursor: pointer; }
}

@media (max-width: 1023px) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-latest-products .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-detail-grid { grid-template-columns: 1fr; }
    .member-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lottery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-number-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .conversation-shell { min-height: calc(100dvh - 126px); }
    .message-thread { max-height: calc(100dvh - 276px); }
    .product-image-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .new-image-preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .upload-desktop { display: none !important; }
    .upload-mobile { display: inline-flex; }
    .product-grid { gap: 9px; }
    .product-card { border-radius: 11px; }
    .product-card__body { padding: 11px; gap: 6px; }
    .product-card__body h3 { font-size: 13px; }
    .product-card__body > strong { font-size: 16px; }
    .product-card__store { font-size: 10px; }
    .catalog-search { grid-template-columns: 1fr; padding: 12px; }
    .product-gallery, .product-buybox, .product-copy { padding: 15px; }
    .product-facts { grid-template-columns: 1fr; }
    .product-actions { grid-template-columns: 1fr; }
    .product-actions #cart-form { grid-column: 1; }
    .store-hero { grid-template-columns: 65px minmax(0, 1fr); padding: 18px; gap: 13px; }
    .store-hero__logo { width: 65px; height: 65px; border-radius: 17px; }
    .store-hero__logo .ui-icon { width: 32px; height: 32px; }
    .member-profile-card { grid-template-columns: 68px minmax(0, 1fr); padding: 16px; gap: 13px; }
    .member-avatar { width: 68px; height: 68px; border-radius: 19px; }
    .member-profile-card > .btn { grid-column: 1 / -1; width: 100%; }
    .member-verification { gap: 4px; }
    .member-shortcuts { gap: 8px; }
    .member-shortcuts a { min-height: 88px; padding: 11px 7px; font-size: 12px; }
    .order-status-panel { padding: 15px; }
    .order-status-grid { gap: 5px; }
    .order-status-grid a { padding: 10px 3px; }
    .order-status-grid strong { font-size: 10px; }
    .account-service-grid, .wallet-balance-grid, .address-grid, .coupon-grid, .lottery-grid { grid-template-columns: 1fr; }
    .account-service-grid > a, .service-form-link > button { padding: 14px; }
    .profile-avatar-large { width: 96px; height: 96px; }
    .address-form, .settings-form, .product-form, .admin-form { padding: 15px 13px; }
    .order-card { grid-template-columns: minmax(0, 1fr) auto; }
    .order-card > strong { grid-column: 1 / -1; }
    .conversation-list > a { grid-template-columns: 42px minmax(0, 1fr) auto; padding: 12px; gap: 9px; }
    .conversation-avatar { width: 42px; height: 42px; }
    .conversation-summary { grid-template-columns: 1fr; }
    .conversation-summary time { grid-column: 1; grid-row: auto; }
    .chat-page-shell { padding: 0; }
    .conversation-shell { min-height: calc(100dvh - 132px - var(--mobile-nav-height)); border-left: 0; border-right: 0; border-radius: 0; }
    .backend-page .conversation-shell { min-height: calc(100dvh - 118px); }
    .conversation-header { padding: 10px 12px; }
    .conversation-intervention { padding: 6px 12px; }
    .conversation-header img, .conversation-header > div > span { flex-basis: 48px; width: 48px; height: 48px; }
    .conversation-header h1 { font-size: 16px; }
    .message-thread { max-height: calc(100dvh - 276px - var(--mobile-nav-height)); padding: 12px; }
    .backend-page .message-thread { max-height: calc(100dvh - 254px); }
    .message-bubble { max-width: 86%; }
    .message-composer { bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); padding: 8px; gap: 5px; }
    .backend-page .message-composer { bottom: 0; }
    .message-composer .btn { flex: 0 0 44px; width: 44px; padding: 0; }
    .message-composer .btn span { display: none; }
    .message-attach { flex-basis: 40px; width: 40px; height: 44px; }
    .document-list, .document-review-grid { grid-template-columns: 1fr; }
    .document-upload-actions { align-items: stretch; }
    .document-upload-actions .btn { flex: 1 1 135px; justify-content: center; }
    .settings-number-grid { grid-template-columns: 1fr; }
    .smtp-test-form { grid-template-columns: 1fr; }
    .cart-item { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
    .cart-item img { width: 72px; height: 62px; }
    .cart-item > form { grid-column: 1 / -1; }
    .cart-total { justify-content: space-between; }
    .product-image-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .product-image-item { padding: 7px; }
    .product-image-item .btn-small { width: 100%; }
    .new-image-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rich-editor__toolbar { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; }
    .rich-editor__toolbar > * { flex: 0 0 auto; }
    .rich-editor__surface { min-height: 220px; padding: 12px; }
    .store-image-preview { max-height: 300px; }
}

@media (max-width: 390px) {
    .product-actions #cart-form { grid-template-columns: 72px minmax(0, 1fr); }
    .member-shortcuts a { font-size: 11px; }
    .order-status-grid strong { font-size: 9px; }
    .message-composer { gap: 4px; }
    .message-attach { flex-basis: 37px; width: 37px; }
}
