:root {
    --bg: #f4f6fb;
    --ink: #111827;
    --muted: #64748b;
    --line: #dbe3ef;
    --panel: #ffffff;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --nav: #111827;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
label { display: grid; gap: 7px; font-weight: 700; font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px 13px; font: inherit; background: #fff; color: var(--ink); }
textarea { min-height: 92px; resize: vertical; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }

.btn { border: 0; border-radius: 8px; padding: 12px 16px; font-weight: 800; cursor: pointer; display: inline-flex; justify-content: center; align-items: center; background: #e8eef7; color: var(--ink); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.small { padding: 8px 10px; font-size: 12px; }
.notice { padding: 13px 15px; border-radius: 8px; margin-bottom: 16px; font-weight: 700; }
.notice.success { background: #e8fff1; color: #116b35; border: 1px solid #b7f0cb; }
.notice.error { background: #fff1f0; color: #a52216; border: 1px solid #ffc6c2; }
.empty { background: #fff; padding: 30px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #111827, #203040); }
.auth-card { width: min(440px, 100%); background: #fff; border-radius: 14px; padding: 26px; display: grid; gap: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.26); }
.auth-card strong { font-size: 28px; }
.auth-card p { margin: 0; color: var(--muted); }

.admin-page { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav); color: #fff; padding: 24px 18px; }
.brand { display: block; font-size: 22px; font-weight: 900; margin-bottom: 28px; }
.brand span { color: var(--brand); }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a { padding: 12px 14px; border-radius: 8px; color: #dbeafe; font-weight: 700; }
.sidebar nav a.active, .sidebar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.admin-content { padding: 32px; overflow-x: auto; }
.page-title span { color: var(--brand); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.page-title h1 { margin: 5px 0 22px; font-size: 32px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 16px; font-size: 18px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; margin-bottom: 18px; }
.metrics article { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.metrics span { color: var(--muted); display: block; margin-bottom: 8px; }
.metrics strong { font-size: 34px; }
.finance-metrics strong { font-size: 24px; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 980px; }
.danger-row { background: #fff7f7; }
.danger-row td { border-bottom-color: #ffc6c2; }
.warning-row { background: #fffaf0; }
.warning-row td { border-bottom-color: #fde68a; }
.source-link { display: inline-flex; width: max-content; margin-top: 7px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; color: var(--brand); font-size: 12px; font-weight: 900; }
.source-link:hover { border-color: var(--brand); background: #e6fffb; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.admin-filter-form { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(180px, 240px) minmax(150px, 210px) auto auto; gap: 12px; align-items: end; }
.api-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.result-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; }
.result-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: #eef2f7; }
.bulk-import-form { display: grid; gap: 16px; }
.bulk-toolbar { position: sticky; top: 0; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: 0 8px 24px rgba(15, 23, 42, .08); }
.bulk-toolbar div { display: grid; gap: 4px; }
.bulk-toolbar span { color: var(--muted); font-size: 13px; }
.check-inline, .select-product { display: flex; grid-template-columns: none; align-items: center; gap: 9px; font-weight: 800; }
.check-inline input, .select-product input { width: auto; }
.select-product { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.select-product:has(input:checked) { background: #fff1ed; border-color: var(--brand); color: var(--brand); }
.settings-form { display: grid; grid-template-columns: repeat(2, minmax(240px, 1fr)); gap: 16px; }
.settings-form h2 { grid-column: 1 / -1; margin-top: 12px; }
.settings-form .btn { width: max-content; }
.status-form { display: grid; gap: 8px; min-width: 220px; }

.store-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px clamp(18px, 4vw, 56px); background: #fff; border-bottom: 1px solid var(--line); }
.store-brand { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 22px; }
.store-brand img { width: 48px; height: 48px; object-fit: contain; }
.store-header strong { color: var(--muted); font-size: 14px; }
.store-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.store-actions a { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; color: #334155; font-weight: 800; font-size: 14px; background: #fff; }
.store-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 24px clamp(18px, 4vw, 56px); }
.store-content { display: grid; gap: 18px; align-content: start; }
.store-search { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 10px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.search-result-note { color: var(--muted); font-weight: 700; }
.category-menu { position: sticky; top: 90px; align-self: start; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 5px; }
.category-menu a { padding: 11px 12px; border-radius: 8px; color: #334155; font-weight: 700; }
.category-menu a.active, .category-menu a:hover { background: #e6fffb; color: var(--brand); }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; align-content: start; }
.product-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 13px; display: grid; gap: 10px; }
.product-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: #eef2f7; }
.product-card small, .product-view small { color: var(--muted); font-weight: 800; }
.product-card h2 { font-size: 16px; line-height: 1.35; margin: 0; min-height: 44px; }
.price { color: var(--brand); font-size: 22px; font-weight: 900; }
.price.large { font-size: 38px; }
.product-badges { display: flex; gap: 7px; flex-wrap: wrap; }
.product-badges span { padding: 6px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 900; }
.product-badges.large { margin: 8px 0 14px; }
.product-badges.large span { background: #e6fffb; color: #115e59; font-size: 13px; }
.product-view { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 36px; padding: 40px clamp(18px, 5vw, 72px); align-items: start; }
.product-photo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; background: #eef2f7; }
.product-view h1 { font-size: clamp(28px, 4vw, 46px); margin: 10px 0 14px; }
.product-view p { color: #334155; line-height: 1.7; }
.buy-box { display: grid; grid-template-columns: 140px auto auto; gap: 12px; align-items: end; margin-top: 24px; }
.checkout-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.checkout-card { width: min(620px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: grid; gap: 14px; }
.checkout-card.wide { width: 100%; }
.checkout-product { display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.checkout-product img { aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; }
.checkout-product span { display: block; color: var(--brand); font-weight: 900; margin-top: 5px; }
.account-page, .cart-page, .checkout-shell { padding: 28px clamp(18px, 4vw, 56px); }
.account-page { display: grid; place-items: start center; }
.account-page.wide-layout { display: grid; grid-template-columns: 1fr; gap: 18px; place-items: stretch; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.choice-card { display: grid; gap: 7px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.choice-card.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(239, 77, 47, .12); }
.choice-card span { color: var(--muted); }
.cart-page { max-width: 980px; margin: 0 auto; }
.cart-row { display: grid; grid-template-columns: 76px 1fr 95px 120px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-row img { width: 76px; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; }
.cart-total, .summary-total { display: flex; justify-content: space-between; gap: 14px; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--line); font-size: 20px; }
.checkout-shell { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.order-summary { position: sticky; top: 90px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.summary-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.summary-row span { color: #334155; }
.radio-card { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 10px; }
.radio-card input { width: auto; margin-top: 3px; }
.address-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 10px; background: #fff; }
.copy-code { display: block; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; color: #0f172a; margin: 10px 0 16px; overflow-wrap: anywhere; }
.integration-status { display: grid; gap: 6px; padding: 14px; border: 1px solid #b7f0cb; border-radius: 10px; background: #e8fff1; color: #116b35; }
.inline-action { margin-top: 12px; }
.payment-panel { max-width: 680px; }
.payment-panel p { color: #334155; line-height: 1.65; }
.payment-button { font-size: 18px; padding: 15px 22px; margin-top: 8px; }

@media (max-width: 900px) {
    .admin-page { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .metrics, .settings-form, .store-layout, .product-view, .checkout-shell, .choice-grid, .form-grid, .buy-box, .store-search, .admin-filter-form { grid-template-columns: 1fr; }
    .category-menu { position: static; }
    .inline-form { grid-template-columns: 1fr; }
    .bulk-toolbar { position: static; flex-direction: column; align-items: stretch; }
    .cart-row { grid-template-columns: 64px 1fr; }
    .cart-row input, .cart-row span { grid-column: 2; }
    .order-summary { position: static; }
}
