:root {
  --plum-950: #2b1322;
  --plum-800: #552742;
  --plum-700: #6c3454;
  --plum-100: #f3e8ef;
  --cream: #fbf8f4;
  --surface: #ffffff;
  --ink: #262126;
  --muted: #756b73;
  --line: #e8e1e5;
  --green: #237a57;
  --green-soft: #e7f4ed;
  --rose: #b74f67;
  --rose-soft: #f9e9ed;
  --sand: #a87527;
  --sand-soft: #f7efdf;
  --shadow: 0 18px 50px rgba(54, 27, 45, 0.09);
  font-family: Arial, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body { margin: 0; min-height: 100vh; background: var(--cream); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 28px 20px; color: #fff;
  background: linear-gradient(155deg, var(--plum-950), var(--plum-800) 62%, #71415e);
  display: flex; flex-direction: column; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark, .mobile-brand {
  width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.38); border-radius: 14px;
  display: grid; place-items: center; background: rgba(255,255,255,.1); color: #fff;
  font: 700 22px Georgia, serif;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; }
.brand span { margin-top: 4px; color: rgba(255,255,255,.66); font-size: 12px; }
.nav-list { display: grid; gap: 8px; }
.nav-item {
  border: 0; background: transparent; color: rgba(255,255,255,.72); padding: 13px 14px;
  border-radius: 12px; display: flex; align-items: center; gap: 11px; text-align: start;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-icon { width: 22px; text-align: center; font-size: 17px; }
.sidebar-note {
  margin-top: auto; border: 1px solid rgba(255,255,255,.13); border-radius: 16px; padding: 14px;
  background: rgba(255,255,255,.06); display: grid; gap: 5px;
}
.sidebar-note span, .sidebar-note small { color: rgba(255,255,255,.62); font-size: 11px; }
.sidebar-note strong { font-size: 12px; line-height: 1.5; }

.main-content { padding: 0 34px 60px; min-width: 0; }
.topbar {
  min-height: 96px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(18px); border-bottom: 1px solid rgba(232,225,229,.75);
}
.page-heading { flex: 1; }
.page-heading p { margin: 0 0 5px; color: var(--muted); font-size: 12px; }
.page-heading h1 { margin: 0; color: var(--plum-950); font-size: clamp(21px, 3vw, 28px); }
.top-actions { display: flex; gap: 9px; }
.language-button, .secondary-button, .primary-button {
  border-radius: 11px; min-height: 40px; padding: 0 15px; font-weight: 700;
}
.language-button, .secondary-button { border: 1px solid var(--line); background: #fff; color: var(--plum-800); }
.primary-button { border: 0; background: var(--plum-800); color: #fff; }
.mobile-brand { display: none; border: 0; background: var(--plum-800); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 24px 0; }
.summary-card { min-height: 132px; border-radius: 18px; padding: 19px; border: 1px solid var(--line); background: #fff; display: grid; gap: 6px; box-shadow: 0 8px 25px rgba(54,27,45,.04); }
.summary-card span { color: var(--muted); font-size: 13px; }
.summary-card strong { font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.summary-card small { color: var(--muted); font-size: 11px; align-self: end; }
.summary-card.plum { border-top: 4px solid var(--plum-700); }
.summary-card.green { border-top: 4px solid var(--green); }
.summary-card.sand { border-top: 4px solid var(--sand); }
.summary-card.rose { border-top: 4px solid var(--rose); }

.view { display: none; }
.active-view { display: block; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 22px; }
.panel-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-title-row h2 { margin: 0; color: var(--plum-950); font-size: 19px; }
.panel-title-row p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.results-pill, .verified-badge { flex: 0 0 auto; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 700; }
.results-pill { background: var(--plum-100); color: var(--plum-800); }
.verified-badge { background: var(--green-soft); color: var(--green); }
.filters-grid { margin-top: 20px; display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 12px; }
label > span { display: block; margin: 0 3px 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select {
  width: 100%; height: 45px; border: 1px solid var(--line); border-radius: 11px; padding: 0 13px;
  background: #fcfbfc; color: var(--ink); outline: 0;
}
input:focus, select:focus { border-color: var(--plum-700); box-shadow: 0 0 0 3px var(--plum-100); }
.input-wrap { position: relative; }
.clear-button { position: absolute; inset-inline-end: 8px; top: 7px; width: 31px; height: 31px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 21px; }
.search-field input { padding-inline-end: 42px; }
.active-filter-bar { margin: 14px 0 0; padding: 11px 14px; border-radius: 12px; background: var(--plum-100); color: var(--plum-800); font-size: 13px; }

.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.product-card { border: 1px solid var(--line); background: #fff; border-radius: 17px; overflow: hidden; box-shadow: 0 8px 22px rgba(54,27,45,.045); transition: transform .16s ease, box-shadow .16s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.product-image-wrap { position: relative; aspect-ratio: 1.05; background: linear-gradient(145deg, #f4eff2, #ede4e9); overflow: hidden; }
.product-image { width: 100%; height: 100%; object-fit: contain; display: block; }
.image-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #a48e9b; font-size: 13px; text-align: center; padding: 18px; }
.sku-badge { position: absolute; top: 10px; inset-inline-start: 10px; border-radius: 8px; padding: 5px 8px; background: rgba(43,19,34,.86); color: #fff; font-weight: 700; font-size: 12px; backdrop-filter: blur(5px); }
.product-body { padding: 14px; }
.product-body h3 { margin: 0; min-height: 38px; font-size: 14px; line-height: 1.45; color: var(--plum-950); }
.product-body .category-name { margin: 7px 0 12px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.balance { display: flex; align-items: baseline; gap: 5px; }
.balance strong { font-size: 19px; color: var(--plum-800); }
.balance small { color: var(--muted); font-size: 10px; }
.status-tag { border-radius: 999px; padding: 6px 8px; font-size: 10px; font-weight: 700; }
.status-shown { background: var(--green-soft); color: var(--green); }
.status-hidden { background: var(--rose-soft); color: var(--rose); }
.status-eid { background: var(--sand-soft); color: var(--sand); }
.product-open { width: 100%; border: 0; padding: 0; background: transparent; text-align: inherit; color: inherit; }
.empty-state { text-align: center; padding: 64px 20px; color: var(--muted); }
.empty-state div { font-size: 38px; }
.empty-state h3 { color: var(--plum-950); margin-bottom: 6px; }
.empty-state p { margin: 0; }
.load-more-row { display: flex; justify-content: center; margin: 20px 0; }

.status-board, .audit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.status-box, .audit-box { border: 1px solid var(--line); background: #fcfbfc; border-radius: 15px; padding: 17px; }
.status-box span, .audit-box span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.status-box strong, .audit-box strong { font-size: 25px; color: var(--plum-800); }
.audit-box p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(31,17,26,.45); backdrop-filter: blur(4px); display: flex; justify-content: flex-end; }
.drawer { width: min(460px, 94vw); height: 100%; overflow: auto; background: #fff; padding: 24px; position: relative; box-shadow: -20px 0 60px rgba(33,15,27,.18); }
[dir="ltr"] .drawer-backdrop { justify-content: flex-start; }
.drawer-close { position: sticky; top: 0; z-index: 2; float: inline-end; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.94); font-size: 22px; }
.drawer-image { clear: both; width: 100%; aspect-ratio: 1.15; object-fit: contain; background: #f4eff2; border-radius: 17px; margin-top: 12px; }
.drawer-placeholder { clear: both; aspect-ratio: 1.15; border-radius: 17px; background: #f4eff2; display: grid; place-items: center; color: var(--muted); margin-top: 12px; }
.drawer h2 { margin: 18px 0 5px; color: var(--plum-950); }
.drawer-subtitle { margin: 0 0 18px; color: var(--muted); }
.details-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.detail-row { display: flex; justify-content: space-between; gap: 18px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--muted); font-size: 12px; }
.detail-row strong { text-align: end; font-size: 13px; }
.mobile-nav { display: none; }

.auth-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: linear-gradient(145deg, rgba(43,19,34,.96), rgba(85,39,66,.92)); }
.auth-card { width: min(420px, 100%); padding: 30px; border-radius: 22px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.25); display: grid; gap: 16px; }
.auth-mark { margin-inline: auto; background: var(--plum-800); }
.auth-card h2 { margin: 2px 0 0; color: var(--plum-950); text-align: center; }
.auth-card > p { margin: -7px 0 4px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.6; }
.auth-card .primary-button { width: 100%; min-height: 47px; }
.auth-card small { color: var(--muted); text-align: center; }
.auth-error { padding: 10px 12px; border-radius: 10px; background: var(--rose-soft); color: #963b50 !important; font-weight: 700; }

@media (max-width: 1180px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main-content { padding: 0 17px 92px; }
  .topbar { min-height: 78px; }
  .mobile-brand { display: grid; }
  .page-heading p { display: none; }
  .secondary-button { display: none; }
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-board, .audit-grid { grid-template-columns: 1fr 1fr; }
  .mobile-nav {
    position: fixed; z-index: 30; inset-inline: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    height: 66px; display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(43,19,34,.96);
    border-radius: 18px; padding: 6px; box-shadow: 0 14px 45px rgba(43,19,34,.28); backdrop-filter: blur(15px);
  }
  .mobile-nav button { border: 0; background: transparent; color: rgba(255,255,255,.62); border-radius: 13px; display: grid; place-items: center; gap: 1px; }
  .mobile-nav button.active { color: #fff; background: rgba(255,255,255,.12); }
  .mobile-nav span { font-size: 18px; }
}

@media (max-width: 560px) {
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .summary-card { min-height: 115px; padding: 14px; border-radius: 15px; }
  .summary-card strong { font-size: 25px; }
  .panel { padding: 16px; border-radius: 17px; }
  .panel-title-row { align-items: center; }
  .panel-title-row p { line-height: 1.55; }
  .filters-grid { grid-template-columns: 1fr; gap: 10px; }
  .product-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .product-body { padding: 11px; }
  .product-body h3 { font-size: 12px; min-height: 35px; }
  .product-body .category-name { font-size: 10px; margin-bottom: 9px; }
  .balance strong { font-size: 17px; }
  .status-tag { font-size: 8px; }
  .status-board, .audit-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
