:root {
    /* ── Backgrounds ── */
    --bg: #08080e;
    --bg-alt: #0c0c14;
    --surface: #11111c;
    --surface2: #181828;
    --surface3: #202038;
    --surface-hover: #1c1c30;

    /* ── Borders ── */
    --border: #282844;
    --border-light: #383858;
    --border-accent: rgba(99,102,241,.25);

    /* ── Text ── */
    --text: #e4e4f0;
    --text2: #8080a8;
    --text3: #606080;

    /* ── Accent ── */
    --accent: #6366f1;
    --accent-hover: #5558e6;
    --accent-glow: rgba(99,102,241,.2);
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

    /* ── Semantic ── */
    --green: #22d45e;
    --green-bg: rgba(34,212,94,.1);
    --red: #f05050;
    --red-bg: rgba(240,80,80,.1);
    --orange: #f59e0b;
    --orange-bg: rgba(245,158,11,.08);

    /* ── Radius ── */
    --radius-xs: 5px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* ── Shadows ── */
    --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
    --shadow-sm: 0 2px 6px rgba(0,0,0,.35);
    --shadow: 0 4px 16px rgba(0,0,0,.4);
    --shadow-md: 0 8px 28px rgba(0,0,0,.45);
    --shadow-lg: 0 12px 48px rgba(0,0,0,.5);
    --shadow-accent: 0 4px 20px rgba(99,102,241,.15);

    /* ── Other ── */
    --header-bg: rgba(17,17,28,.92);
    --logo-bg: var(--accent);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    --ease-out: cubic-bezier(.22,1,.36,1);
    --ease-in-out: cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
    --bg: #f0f0f5;
    --bg-alt: #e6e6ed;
    --surface: #ffffff;
    --surface2: #f0f0f5;
    --surface3: #e2e2ea;
    --surface-hover: #f5f5fa;
    --border: #ceced6;
    --border-light: #c2c2cc;
    --border-accent: rgba(88,86,214,.15);
    --text: #1c1c1e;
    --text2: #636366;
    --text3: #aeaeb2;
    --accent: #5856d6;
    --accent-hover: #4a48b8;
    --accent-glow: rgba(88,86,214,.12);
    --accent-gradient: linear-gradient(135deg, #5856d6, #7c6cf0);
    --green: #34c759;
    --green-bg: rgba(52,199,89,.08);
    --red: #ff3b30;
    --red-bg: rgba(255,59,48,.06);
    --orange: #ff9500;
    --orange-bg: rgba(255,149,0,.06);
    --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
    --shadow-sm: 0 2px 6px rgba(0,0,0,.06);
    --shadow: 0 4px 14px rgba(0,0,0,.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,.07);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.08);
    --shadow-accent: 0 4px 16px rgba(88,86,214,.12);
    --header-bg: rgba(255,255,255,.82);
}

[data-theme="light"] .card { border-color: var(--border); }
[data-theme="light"] .qr-frame { box-shadow: 0 0 0 3px rgba(88,86,214,.08), 0 8px 32px rgba(88,86,214,.1); }

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

::selection { background:rgba(99,102,241,.3); color:#fff; }
[data-theme="light"] ::selection { background:rgba(88,86,214,.2); }

::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--text3); }

body {
    font-family:var(--font);
    background:var(--bg);
    color:var(--text);
    line-height:1.7;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
    transition:background .35s var(--ease-out), color .35s var(--ease-out);
}

a { color:inherit; text-decoration:none; }
button { font-family:inherit; cursor:pointer; }
input, select, textarea { font-family:inherit; }
img { max-width:100%; display:block; }

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

/* fade-in on load */
@keyframes fadeUp {
    from { opacity:0; transform:translateY(12px); }
    to   { opacity:1; transform:translateY(0); }
}
.grid, .order-card, .admin-main > * { animation:fadeUp .4s var(--ease-out) both; }
.grid > * { animation:none; }

/* SVG icon base */
.icon, .icon-sm, .icon-lg, .icon-xl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.icon { width: 20px; height: 20px; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon svg, .icon-sm svg, .icon-lg svg, .icon-xl svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Theme toggle */
.theme-btn {
    display:flex; align-items:center; justify-content:center;
    width:34px; height:34px; border-radius:var(--radius-sm);
    border:1px solid var(--border); background:var(--surface2); color:var(--text2);
    cursor:pointer; transition:all .2s var(--ease-out);
}
.theme-btn:hover { border-color:var(--accent); color:var(--accent); background:var(--surface3); }
.theme-btn:active { transform:scale(.92); }
.theme-btn svg { width:17px; height:17px; }

/* Language selector */
.lang-select {
    background:var(--surface2); color:var(--text);
    border:1px solid var(--border); border-radius:var(--radius-sm);
    padding:5px 10px; font-size: 18px; cursor:pointer; outline:none;
    transition:border-color .2s var(--ease-out);
    appearance:none; -webkit-appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238888aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right 8px center; padding-right:26px;
}
.lang-select:hover, .lang-select:focus { border-color:var(--accent); }
.lang-select option { background:var(--surface); color:var(--text); }

/* =============== HEADER =============== */
.header {
    background:var(--header-bg);
    -webkit-backdrop-filter:blur(14px);
    backdrop-filter:blur(14px);
    border-bottom:1px solid var(--border);
    position:sticky; top:0; z-index:100;
    transition:background .35s var(--ease-out), border-color .35s var(--ease-out);
}
.header .container {
    display:flex; align-items:center; justify-content:space-between;
    height:60px;
}
.header-left { display:flex; align-items:center; gap:12px; }
.header-logo-link {
    display:flex; align-items:center; gap:10px; text-decoration:none; color:inherit;
}
.header-logo-img { height:32px; width:auto; display:block; }
.header-logo-fallback {
    width:32px; height:32px; border-radius:var(--radius-sm);
    display:flex; align-items:center; justify-content:center; color:#fff;
    background:var(--accent-gradient);
    box-shadow:0 2px 8px var(--accent-glow);
}
.header-logo-fallback svg { width:18px; height:18px; stroke-width:2.5; }
.header h1 {
    font-size: 26px; font-weight:800;
    letter-spacing:-.4px;
    background:var(--accent-gradient);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
    white-space:nowrap;
}
.header-right { display:flex; align-items:center; gap:8px; }
.header-back {
    display:flex; align-items:center; gap:4px;
    color:var(--text2); font-size: 21px; font-weight:500;
    padding:6px 10px; border-radius:var(--radius-sm);
    transition:all .15s var(--ease-out);
}
.header-back:hover { color:var(--text); background:var(--surface2); }
.header-back svg { width:18px; height:18px; }

/* =============== TABS =============== */
.tabs {
    display:flex; gap:3px; margin-bottom:16px;
    overflow-x:auto; -webkit-overflow-scrolling:touch;
    padding:4px 6px; scrollbar-width:thin;
    background:var(--surface2); border-radius:var(--radius);
    border:1px solid var(--border);
}
.tabs::-webkit-scrollbar { height:2px; }
.tabs::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
.tabs .tab {
    display:inline-flex; align-items:center; gap:6px;
    padding:7px 14px; border-radius:7px;
    font-size: 20px; font-weight:600;
    color:var(--text2); cursor:pointer;
    transition:all .18s var(--ease-out);
    white-space:nowrap; text-decoration:none; flex-shrink:0;
    position:relative;
}
.tabs .tab:hover { color:var(--text); background:var(--surface3); }
.tabs .tab.active {
    color:#fff;
    background:var(--accent-gradient);
    box-shadow:0 2px 10px var(--accent-glow);
}
.tabs .tab .count {
    font-size: 15px; font-weight:700; opacity:.5;
}
.tabs .tab.active .count { opacity:.75; }

/* =============== FILTERS =============== */
.filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 20px;
    transition: background .3s;
}
.filters-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.filters-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.filters-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text2);
}
.filters-label svg { stroke: var(--text2); width: 15px; height: 15px; }
.filters-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text3);
    cursor: pointer;
    transition: all .2s;
}
.view-btn:hover { border-color: var(--accent); color: var(--accent); }
.view-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.view-btn svg { width: 16px; height: 16px; }

.toggle-tags {
    font-size: 18px;
    color: var(--accent);
    cursor: pointer;
    background: none;
    border: none;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all .15s;
}
.toggle-tags:hover { background: var(--surface2); }
.tags-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tag {
    display:inline-flex; align-items:center; gap:4px;
    padding:5px 12px; border-radius:20px;
    font-size: 18px; font-weight:500;
    background:var(--surface2); color:var(--text2);
    border:1px solid var(--border); cursor:pointer;
    transition:all .18s var(--ease-out);
    text-decoration:none; white-space:nowrap;
}
.tag:hover {
    border-color:var(--accent); color:var(--text);
    background:var(--surface3); transform:translateY(-1px);
}
.tag:active { transform:scale(.96); }
.tag.active {
    background:var(--accent-gradient); color:#fff;
    border-color:transparent;
    box-shadow:0 2px 10px var(--accent-glow);
}
.tag .count { font-size: 15px; font-weight:600; opacity:.5; margin-left:2px; }
.tag.active .count { opacity:.75; }
.tag-remove {
    display: inline-flex;
    margin-left: 2px;
    opacity: .6;
    transition: opacity .15s;
}
.tag-remove:hover { opacity: 1; }
.tag-remove svg { width: 12px; height: 12px; }
.hide-tag { display: none; }

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 12px;
}
.active-filters .tag {
    padding-right: 8px;
    background: rgba(99,102,241,.12);
    border-color: rgba(99,102,241,.3);
    color: var(--accent);
}
.clear-all {
    font-size: 18px;
    color: var(--text3);
    cursor: pointer;
    background: none;
    border: none;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all .15s;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.clear-all:hover { color: var(--red); }
.result-count {
    font-size: 20px;
    color: var(--text3);
    margin-top: 12px;
    font-weight: 500;
}

/* =============== GRID / CARD VIEW =============== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 24px 0 40px;
}

.card {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    overflow:hidden;
    transition:all .3s var(--ease-out);
    display:flex; flex-direction:column;
    position:relative;
}
.card::before {
    content:'';
    position:absolute; inset:0;
    border-radius:inherit;
    opacity:0;
    background:linear-gradient(135deg, rgba(99,102,241,.04) 0%, transparent 60%);
    transition:opacity .3s var(--ease-out);
    pointer-events:none;
}
.card::after {
    content:'';
    position:absolute; inset:-1px;
    border-radius:inherit;
    opacity:0;
    background:linear-gradient(135deg, var(--accent), transparent 60%);
    transition:opacity .3s var(--ease-out);
    pointer-events:none;
    z-index:-1;
}
.card:hover {
    border-color:var(--border-accent);
    transform:translateY(-3px);
    box-shadow:0 8px 32px rgba(99,102,241,.1);
}
.card:hover::before { opacity:1; }
.card:hover::after { opacity:.4; }
.card-img-wrap {
    width:100%; height:110px;
    display:flex; align-items:center; justify-content:center;
    background:var(--bg-alt); padding:20px;
    border-bottom:1px solid var(--border);
    position:relative; overflow:hidden;
}
.card-img-wrap::after {
    content:'';
    position:absolute; inset:0;
    background:linear-gradient(180deg, transparent 60%, var(--surface));
    opacity:.3;
}
.card-img {
    max-width:100%; max-height:100%;
    object-fit:contain;
    filter:drop-shadow(0 2px 4px rgba(0,0,0,.25));
    transition:transform .3s var(--ease-out);
}
.card:hover .card-img { transform:scale(1.06); }
.card-body { padding:14px 16px 16px; flex:1; display:flex; flex-direction:column; }
.card-title {
    font-size: 20px; font-weight:600; line-height:1.5;
    display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical;
    overflow:hidden; min-height:58px; color:var(--text);
}
.card-tags { display:flex; flex-wrap:wrap; gap:4px; margin:10px 0; }
.card-tags .tag {
    font-size: 15px; padding:2px 8px;
    background:var(--surface3); border-color:transparent;
    color:var(--text2); cursor:pointer;
    transition:all .15s var(--ease-out);
}
.card-tags .tag:hover { background:var(--accent); color:#fff; border-color:var(--accent); transform:none; }
.card-footer {
    display:flex; align-items:center; justify-content:space-between;
    margin-top:auto; padding-top:12px; border-top:1px solid var(--border);
}
.card-price-group { display:flex; flex-direction:column; }
.card-price {
    font-size: 30px; font-weight:800;
    background:var(--accent-gradient);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
    letter-spacing:-.3px; line-height:1.2;
    white-space:nowrap;
}
.card-price-unit { font-size: 17px; font-weight:500; color:var(--text3); white-space:nowrap; }
.card-stock {
    font-size: 18px; font-weight:600; padding:3px 10px; border-radius:6px;
    white-space:nowrap;
}
.card-stock.in-stock { color:var(--green); background:var(--green-bg); }
.card-stock.out { color:var(--red); background:var(--red-bg); }
.card-btn {
    display:flex; align-items:center; justify-content:center; gap:6px;
    width:100%; padding:11px 0; margin-top:14px;
    border:none; border-radius:var(--radius-sm);
    background:var(--accent-gradient); color:#fff;
    font-size: 21px; font-weight:600; cursor:pointer;
    white-space:nowrap;
    transition:all .2s var(--ease-out); position:relative; overflow:hidden;
}
.card-btn::before {
    content:''; position:absolute; inset:0;
    background:rgba(255,255,255,.1);
    opacity:0; transition:opacity .2s;
}
.card-btn:hover::before { opacity:1; }
.card-btn:hover { box-shadow:0 4px 20px var(--accent-glow); }
.card-btn:active { transform:scale(.98); }
.card-btn:disabled { background:var(--surface2); color:var(--text3); cursor:not-allowed; box-shadow:none; }
.card-btn:disabled::before { display:none; }
.card-btn svg { width:16px; height:16px; }

/* =============== LIST VIEW =============== */
[data-view="list"] .grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
[data-view="list"] .list-header {
    display: grid;
    grid-template-columns: 44px 2fr 1.2fr 140px 120px 150px;
    gap: 12px;
    padding: 10px 16px;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text3);
    border-bottom: 1px solid var(--border);
    align-items: center;
}
[data-view="list"] .card {
    display: grid;
    grid-template-columns: 44px 2fr 1.2fr 140px 120px 150px;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    min-height: auto;
}
[data-view="list"] .card:hover { transform: none; }
[data-view="list"] .card-img-wrap {
    grid-column: 1;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: var(--bg-alt);
    border-radius: 6px;
}
[data-view="list"] .card-img { max-width: 100%; max-height: 100%; }
[data-view="list"] .card-body {
    display: contents;
}
[data-view="list"] .card-title {
    grid-column: 2;
    min-height: auto;
    -webkit-line-clamp: 2;
    font-size: 20px;
}
[data-view="list"] .card-tags {
    grid-column: 3;
    margin: 0;
}
[data-view="list"] .card-tags .tag { font-size: 15px; }
[data-view="list"] .card-footer {
    display: contents;
}
[data-view="list"] .card-price-group {
    grid-column: 4;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}
[data-view="list"] .card-price { font-size: 23px; }
[data-view="list"] .card-price-unit { font-size: 15px; }
[data-view="list"] .card-stock {
    grid-column: 5;
    font-size: 17px;
    padding: 2px 8px;
    text-align: center;
}
[data-view="list"] .card-btn {
    grid-column: 6;
    margin: 0;
    padding: 7px 14px;
    font-size: 18px;
    width: auto;
}
[data-view="list"] .card-btn svg { width: 14px; height: 14px; }

/* =============== MODAL =============== */
.modal-overlay {
    display:none; position:fixed; inset:0;
    background:rgba(0,0,0,.65);
    backdrop-filter:blur(6px);
    -webkit-backdrop-filter:blur(6px);
    z-index:999; align-items:center; justify-content:center;
    padding:20px;
    animation:overlayIn .2s var(--ease-out);
}
@keyframes overlayIn {
    from { opacity:0; }
    to { opacity:1; }
}
.modal-overlay.show { display:flex; }
.modal {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-xl);
    padding:32px; width:100%; max-width:440px;
    box-shadow:var(--shadow-lg);
    animation:modalIn .25s var(--ease-out);
}
.modal-buy { max-width:460px; }
@keyframes modalIn {
    from { opacity:0; transform:scale(.92) translateY(16px); }
    to { opacity:1; transform:scale(1) translateY(0); }
}
.modal-header { display:flex; align-items:center; gap:12px; margin-bottom:20px; }
.modal-header-icon {
    width:40px; height:40px;
    background:var(--accent-gradient); border-radius:var(--radius-sm);
    display:flex; align-items:center; justify-content:center; color:#fff;
    flex-shrink:0;
}
.modal-header-icon svg { width:20px; height:20px; stroke-width:2; }
.modal-header h2 { font-size: 20px; font-weight:700; line-height:1.3; }
.modal .product-name {
    font-size: 13px; color:var(--text3);
    display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical;
    overflow:hidden; margin-top:1px;
}
.price-info {
    font-size: 15px; color:var(--text2); margin-bottom:20px;
    text-align:center; padding:12px;
    background:var(--surface2); border-radius:var(--radius-sm);
    line-height:1.6;
}
.price-info strong {
    background:var(--accent-gradient);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
    font-size: 22px;
}
.form-row { display:flex; gap:12px; }
.form-group { margin-bottom:16px; flex:1; }
.form-group label { display:block; font-size: 13px; font-weight:600; color:var(--text2); margin-bottom:6px; }
.form-group input {
    width:100%; padding:11px 14px; border-radius:var(--radius-sm);
    border:1px solid var(--border); background:var(--surface2);
    color:var(--text); font-size: 15px; outline:none;
    transition:all .2s var(--ease-out);
}
.form-group input:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-glow); }
.form-group input:disabled { opacity:.5; cursor:not-allowed; }
.input-hint { font-size: 12px; color:var(--text3); margin-top:5px; }
.modal-total {
    display:flex; align-items:center; justify-content:space-between;
    padding:14px 18px; margin:20px 0;
    background:var(--accent-glow); border:1px solid var(--border-accent);
    border-radius:var(--radius-sm);
}
.modal-total-label { font-size: 15px; color:var(--text2); font-weight:600; }
.modal-total-value {
    font-size: 26px; font-weight:800;
    background:var(--accent-gradient);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
}
.min-payment-warning {
    display:flex; align-items:flex-start; gap:8px;
    padding:10px 14px; margin-bottom:16px;
    background:var(--red-bg); border:1px solid rgba(240,80,80,.2);
    border-radius:var(--radius-sm);
    font-size:13px; line-height:1.5; color:var(--red);
}
.min-payment-warning svg { stroke:var(--red); }
.modal-actions { display:flex; gap:10px; }
.modal-actions button {
    flex:1; padding:13px; border-radius:var(--radius-sm);
    border:none; font-size: 15px; font-weight:600; cursor:pointer;
    transition:all .2s var(--ease-out);
    display:flex; align-items:center; justify-content:center; gap:6px;
}
.modal-actions button svg { width:16px; height:16px; }
.btn-cancel { background:var(--surface2); color:var(--text2); border:1px solid var(--border) !important; }
.btn-cancel:hover { background:var(--surface3); color:var(--text); }
.btn-submit { background:var(--accent-gradient); color:#fff; }
.btn-submit:hover { box-shadow:0 4px 16px var(--accent-glow); }
.btn-submit:disabled { opacity:.5; cursor:not-allowed; box-shadow:none; }

/* =============== ORDER PAGE =============== */
.order-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 32px 20px 48px;
}
.order-card {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-xl);
    padding:32px; max-width:640px; width:100%;
    box-shadow:var(--shadow-md);
    transition:background .35s var(--ease-out), border-color .35s var(--ease-out);
}
.order-status { text-align:center; margin-bottom:28px; }
.status-icon-wrap {
    width:64px; height:64px; border-radius:50%;
    background:var(--orange-bg);
    display:flex; align-items:center; justify-content:center;
    margin:0 auto 14px; position:relative;
}
.status-icon-wrap svg { width:28px; height:28px; color:var(--orange); stroke-width:2; }
.status-pulse {
    position:absolute; inset:-4px; border-radius:50%;
    border:2px solid rgba(245,158,11,.25);
    animation:pulseRing 2.5s var(--ease-out) infinite;
}
@keyframes pulseRing {
    0% { transform:scale(1); opacity:1; }
    100% { transform:scale(1.25); opacity:0; }
}
.status-label { font-size: 30px; font-weight:700; color:var(--orange); }
.status-sub { font-size: 20px; color:var(--text3); margin-top:4px; }

.order-detail {
    background:var(--surface2); border-radius:var(--radius);
    padding:16px 20px; margin-bottom:24px;
}
.order-detail .row {
    display:flex; justify-content:space-between; align-items:center;
    padding:6px 0; font-size: 20px;
}
.order-detail .row .label { color:var(--text2); }
.order-detail .row .value { font-weight:600; text-align:right; }
.order-detail .text-trunc { max-width:240px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.order-detail .divider { border:none; border-top:1px solid var(--border); margin:8px 0; }
.order-detail .total-row { margin-top:4px; }
.order-detail .total-amount {
    font-size: 33px;
    background:var(--accent-gradient);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
}

.payment-section { margin-bottom:24px; }
.payment-header {
    display:flex; align-items:center; justify-content:center; gap:8px;
    font-size:20px; font-weight:600; margin-bottom:20px;
}
.payment-header svg { width:20px; height:20px; color:var(--green); }
.network-badge {
    display:inline-block; padding:2px 10px; border-radius:4px;
    background:var(--accent-gradient); color:#fff;
    font-size: 15px; font-weight:700; letter-spacing:.3px;
    vertical-align:middle; margin-left:6px;
}
.qr-wrapper { text-align:center; margin-bottom:24px; }
.qr-frame {
    width:210px; height:210px; background:#fff;
    border-radius:var(--radius-lg); padding:14px;
    margin:0 auto 16px;
    box-shadow:0 0 0 3px var(--border-accent), 0 8px 32px var(--shadow-accent);
    position:relative;
}
.qr-frame::after {
    content:''; position:absolute; inset:-1px; border-radius:inherit;
    background:var(--accent-gradient); z-index:-1; opacity:.25;
}
.qr-frame img { width:100%; height:100%; object-fit:contain; display:block; }
.qr-amount {
    font-size: 39px; font-weight:800; letter-spacing:-.5px;
    background:var(--accent-gradient);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
}
.qr-hint { font-size: 18px; color:var(--text3); margin-top:4px; }

.address-section { background:var(--surface2); border-radius:var(--radius); padding:16px; }
.address-label { font-size: 18px; color:var(--text3); margin-bottom:8px; font-weight:500; }
.address-box {
    display:flex; align-items:center; gap:8px;
    background:var(--bg); border:1px solid var(--border);
    border-radius:var(--radius-sm); padding:10px 14px;
    transition:border-color .2s var(--ease-out);
}
.address-box:focus-within { border-color:var(--accent); }
.address-text {
    flex:1; font-family:var(--font-mono); font-size: 18px;
    line-height:1.6; word-break:break-all; color:var(--text); user-select:all;
}
.copy-btn {
    flex-shrink:0; display:flex; align-items:center; gap:5px;
    padding:7px 14px; border-radius:var(--radius-sm);
    border:1px solid var(--border); background:var(--surface2);
    color:var(--accent); font-size: 18px; font-weight:600;
    cursor:pointer; transition:all .2s var(--ease-out);
}
.copy-btn svg { width:14px; height:14px; }
.copy-btn:hover { background:var(--accent); color:#fff; border-color:var(--accent); }
.copy-btn:active { transform:scale(.95); }
.copy-btn.copied { background:var(--green); color:#fff; border-color:var(--green); }
.address-meta { display:flex; justify-content:space-between; font-size: 18px; color:var(--text3); margin-top:10px; }
.address-meta strong { color:var(--text2); }

.payment-steps { display:flex; flex-direction:column; gap:12px; margin-bottom:24px; }
.step { display:flex; align-items:flex-start; gap:14px; }
.step-num {
    width:28px; height:28px; border-radius:50%;
    background:var(--accent-gradient); color:#fff;
    font-size: 18px; font-weight:700;
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0; margin-top:1px;
}
.step-text { font-size: 20px; color:var(--text2); line-height:1.5; padding-top:4px; }
.step-text strong { color:var(--text); }

.notice {
    display:flex; align-items:flex-start; gap:10px;
    background:var(--orange-bg);
    border:1px solid rgba(245,158,11,.12);
    border-radius:var(--radius); padding:14px 16px;
    font-size: 18px; color:var(--orange); line-height:1.7; margin-bottom:20px;
}
.notice svg { width:16px; height:16px; flex-shrink:0; margin-top:2px; stroke:var(--orange); }
.notice a { color:var(--accent); font-weight:600; text-decoration:underline; text-underline-offset:2px; }
.notice a:hover { color:var(--text); }

.back-link {
    display:flex; align-items:center; justify-content:center; gap:8px;
    padding:13px 0; border-radius:var(--radius-sm);
    background:var(--surface2); color:var(--text);
    text-decoration:none; font-size: 21px; font-weight:600;
    transition:all .2s var(--ease-out);
    width:100%; border:1px solid var(--border);
}
.back-link:hover { background:var(--surface3); border-color:var(--border-light); transform:translateY(-1px); }
.back-link:active { transform:translateY(0); }
.back-link svg { width:16px; height:16px; }

/* =============== TIMER BAR =============== */
.timer-bar {
    display:flex; align-items:center; gap:12px;
    background:var(--surface2); border:1px solid var(--border);
    border-radius:var(--radius); padding:14px 16px;
    margin-bottom:20px; position:relative; overflow:hidden;
}
.timer-icon { font-size:22px; flex-shrink:0; }
.timer-info { flex-shrink:0; }
.timer-label { font-size:12px; color:var(--text3); font-weight:500; }
.timer-value {
    font-size:24px; font-weight:800; letter-spacing:-.3px;
    font-variant-numeric:tabular-nums;
    background:var(--accent-gradient);
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
}
.timer-progress-wrap {
    flex:1; height:6px; background:var(--surface3);
    border-radius:3px; overflow:hidden; min-width:60px;
}
.timer-progress {
    height:100%; width:100%;
    background:var(--accent-gradient);
    border-radius:3px; transition:width 1s linear;
}
.timer-bar.timer-warning { border-color:rgba(245,158,11,.3); background:var(--orange-bg); }
.timer-bar.timer-warning .timer-value { background:linear-gradient(135deg,#f59e0b,#f97316); -webkit-background-clip:text; background-clip:text; }
.timer-bar.timer-warning .timer-progress { background:linear-gradient(135deg,#f59e0b,#f97316); }
.timer-bar.timer-critical { border-color:rgba(240,80,80,.3); background:var(--red-bg); }
.timer-bar.timer-critical .timer-value { background:linear-gradient(135deg,#f05050,#ef4444); -webkit-background-clip:text; background-clip:text; }
.timer-bar.timer-critical .timer-progress { background:linear-gradient(135deg,#f05050,#ef4444); }

/* =============== FOOTER =============== */
.footer {
    text-align: center;
    padding: 24px 0;
    font-size: 18px;
    color: var(--text3);
    border-top: 1px solid var(--border);
}
.page-text {
    background:var(--surface); border:1px solid var(--border);
    border-radius:12px; padding:14px 20px;
    font-size: 20px; line-height:1.7; color:var(--text2);
}

.page-text p:first-child { margin-top:0; }
.page-text p:last-child { margin-bottom:0; }

/* =============== RESPONSIVE =============== */

/* ≤ 1024px — 中等屏幕紧凑 */
@media (max-width: 1024px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    .container { padding: 0 20px; }
}

/* ≤ 900px — 列表视图紧凑 */
@media (max-width: 900px) {
    [data-view="list"] .card { grid-template-columns: 36px 1fr auto; gap: 4px 10px; padding: 10px 12px; }
    [data-view="list"] .list-header { display: none; }
    [data-view="list"] .card-img-wrap { grid-column: 1; grid-row: 1 / 3; }
    [data-view="list"] .card-title { grid-column: 2; grid-row: 1; font-size: 17px; }
    [data-view="list"] .card-tags { display: none; }
    [data-view="list"] .card-price-group { grid-column: 2; grid-row: 2; }
    [data-view="list"] .card-stock { display: none; }
    [data-view="list"] .card-btn { grid-column: 3; grid-row: 1 / 3; font-size: 16px; padding: 5px 10px; }
    [data-view="list"] .card-btn svg { width: 12px; height: 12px; }
}

/* ≤ 768px — 平板 */
@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
    .order-card { padding: 24px; }
    .order-detail { margin-bottom: 20px; }
    .modal { padding: 28px; }
    .modal-buy { padding: 24px; }
    .qr-frame { width: 180px; height: 180px; }
    .card-img-wrap { height: 90px; padding: 16px; }
    .tags-scroll {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        scrollbar-width: thin;
    }
    .tags-scroll::-webkit-scrollbar { height: 3px; }
    .tags-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    .tag { flex-shrink: 0; }
    .tabs { padding: 3px 4px; }
    .tabs .tab { padding: 6px 10px; font-size: 18px; }
    .card-title { min-height: 54px; }
    .card-price { font-size: 27px; }
}

/* ≤ 480px — 手机 */
@media (max-width: 480px) {
    .grid { grid-template-columns: 1fr; gap: 10px; }
    .container { padding: 0 12px; }
    .order-card { padding: 20px; border-radius: var(--radius); }
    .header .container { height: 50px; }
    .header h1 { font-size: 23px; }
    .header-logo-fallback { width: 28px; height: 28px; }
    .header-logo-fallback svg { width: 15px; height: 15px; }
    .header-logo-img { height: 26px; }
    .header-left { gap: 8px; }
    .theme-btn { width: 30px; height: 30px; }
    .theme-btn svg { width: 15px; height: 15px; }
    .card-title { font-size: 17px; min-height: auto; -webkit-line-clamp: 2; }
    .card-img-wrap { height: 72px; padding: 12px; }
    .card-price { font-size: 23px; }
    .card-price-unit { font-size: 13px; }
    .card-stock { font-size: 14px; padding: 2px 8px; }
    .card-btn { padding: 8px 0; font-size: 17px; }
    .order-detail { padding: 12px 14px; }
    .order-detail .text-trunc { max-width: 120px; }
    .order-detail .row { font-size: 18px; }
    .order-detail .total-amount { font-size: 27px; }
    .modal { padding: 20px; margin: 8px; }
    .modal-buy { padding: 18px; }
    .modal-header { gap: 10px; margin-bottom: 16px; }
    .modal-header-icon { width: 34px; height: 34px; }
    .modal-header-icon svg { width: 17px; height: 17px; }
    .modal-header h2 { font-size: 17px; }
    .modal .product-name { font-size: 12px; }
    .price-info { font-size: 13px; padding: 10px; margin-bottom: 16px; }
    .price-info strong { font-size: 18px; }
    .form-row { flex-direction: column; gap: 0; }
    .form-row .form-group { margin-bottom: 0; }
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 12px; }
    .form-group input { font-size: 14px; padding: 10px 12px; }
    .modal-total { padding: 12px 14px; margin: 16px 0; }
    .modal-total-label { font-size: 13px; }
    .modal-total-value { font-size: 21px; }
    .modal-actions { flex-direction: column; }
    .modal-actions button { padding: 12px; font-size: 14px; }
    .filters { padding: 10px 0; }
    .filters-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .filters-toolbar-right { align-self: flex-end; }
    .result-count { font-size: 18px; }
    .active-filters .tag { font-size: 17px; padding: 3px 10px; }
    .payment-header { font-size: 20px; }
    .step-text { font-size: 18px; }
    .step-num { width: 24px; height: 24px; font-size: 17px; }
    .address-box { flex-direction: column; align-items: stretch; }
    .copy-btn { justify-content: center; }
    .address-meta { flex-direction: column; gap: 4px; }
    .notice { font-size: 17px; padding: 12px; }
    .qr-frame { width: 160px; height: 160px; padding: 12px; }
    .qr-amount { font-size: 33px; }
    .status-icon-wrap { width: 52px; height: 52px; }
    .status-icon-wrap svg { width: 22px; height: 22px; }
    .status-label { font-size: 26px; }
    .timer-bar { padding: 10px 12px; gap: 8px; }
    .timer-icon { font-size: 18px; }
    .timer-value { font-size: 18px; }
    .timer-label { font-size: 11px; }
    .timer-progress-wrap { min-width: 40px; }
}

/* =============== RTL =============== */
[dir="rtl"] .header-left { flex-direction: row-reverse; }
[dir="rtl"] .header-right { flex-direction: row-reverse; }
[dir="rtl"] .header-back svg { transform: scaleX(-1); }
[dir="rtl"] .back-link svg { transform: scaleX(-1); }
[dir="rtl"] .tabs { direction: rtl; }
[dir="rtl"] .tags-scroll { direction: rtl; }
[dir="rtl"] .card-tags { direction: rtl; }
[dir="rtl"] .filters-toolbar { flex-direction: row-reverse; }
[dir="rtl"] .step { flex-direction: row-reverse; }
[dir="rtl"] .order-detail .row { flex-direction: row-reverse; }
[dir="rtl"] .address-box { direction: ltr; }
[dir="rtl"] .modal-header-icon { margin-left: 10px; margin-right: 0; }
[dir="rtl"] .lang-select { margin-left: 0; margin-right: auto; }
[dir="rtl"] .timer-bar { flex-direction: row-reverse; }
