:root {
  --accent: #00adb5;
  --accent-dark: #078b92;
  --amber: #ffd369;
  --ink: #393e46;
  --muted: #737780;
  --line: #e3e5e9;
  --panel: #f6f7f9;
  --soft: #fbfbfc;
  --blue: #1884d3;
  --ok: #16845f;
  --shadow: 0 18px 44px rgba(22, 28, 45, .12);
  --glass: rgba(255, 255, 255, .78);
  --glow: 0 0 0 1px rgba(255, 255, 255, .68), 0 18px 42px rgba(226, 24, 18, .08);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  direction: ltr;
  animation: none;
}

body.locked .topbar,
body.locked .app-page {
  filter: blur(6px);
  pointer-events: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(226, 24, 18, .14), transparent 28%),
    radial-gradient(circle at 80% 15%, rgba(255, 182, 0, .16), transparent 26%),
    rgba(255, 255, 255, .72);
  backdrop-filter: blur(18px);
}

.auth-gate[hidden] {
  display: none !important;
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow);
  border-radius: 12px;
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-logo {
  width: 150px;
  height: 88px;
}

.login-card label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.brand-home {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.page-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.page-tabs a {
  border: 0;
  background: transparent;
  border-bottom: 3px solid transparent;
  padding: 0 16px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.page-tabs a.active {
  color: var(--accent);
  border-color: var(--accent);
}

.app-page {
  display: none !important;
}

.app-page.active {
  display: grid !important;
}

.page-shell {
  min-height: calc(100vh - 72px);
  padding: 34px;
  background: #fff;
  gap: 18px;
  align-content: start;
}

.page-hero {
  border: 1px solid rgba(255,255,255,.8);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 28px;
  border-radius: 10px;
}

.page-hero h1 {
  margin: 0 0 8px;
}

.page-hero p {
  margin: 0;
  color: var(--muted);
}

.tool-panel {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 28px rgba(22, 28, 45, .08);
  padding: 22px;
  border-radius: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.settings-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(22, 28, 45, .06);
  scrollbar-width: thin;
}

.settings-tabs button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.settings-tabs button.active {
  background: var(--ink);
  color: #fff;
  box-shadow: inset 0 -4px 0 var(--accent);
}

.settings-panel:not(.active) { display: none; }

.users-panel {
  grid-column: 1 / -1;
}

.categories-panel {
  grid-column: 1 / -1;
}

.trash-panel {
  align-content: start;
}

.daftra-panel {
  grid-column: 1 / -1;
}

.user-editor {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.permission-picker {
  display: grid;
  gap: 7px;
}

.permission-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-action {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.check-list {
  border: 1px solid #c9ced6;
  background: #fff;
  min-height: 92px;
  max-height: 150px;
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.check-list.tall {
  max-height: 220px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #343841;
}

.check-list input {
  width: auto;
  min-height: auto;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.export-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.page-size-control {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.page-size-control select {
  width: 78px;
  min-height: 42px;
}

.pagination-bar {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pagination-bar span {
  color: var(--muted);
  font-weight: 900;
}

.pagination-bar button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.export-panel {
  display: grid;
  gap: 22px;
  direction: ltr;
  text-align: left;
}

.export-scope-tabs {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  gap: 0;
  width: min(100%, 560px);
  border: 1px solid #cfd7dc;
  border-radius: 9px;
  overflow: hidden;
}

.export-scope-tabs label,
.export-price-options label,
.export-product-list label {
  cursor: pointer;
}

.export-scope-tabs input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.export-scope-tabs span {
  min-height: 44px;
  border: 0;
  border-right: 1px solid #dfe4e7;
  border-radius: 0;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #555b65;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.export-scope-tabs input:checked + span {
  color: #fff;
  background: var(--ink);
  box-shadow: inset 0 -4px 0 var(--accent);
}

.export-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 450px));
  gap: 12px;
  align-items: start;
}

.export-fields label,
.export-price-box > label,
.report-type-field { max-width: 450px; }

.export-fields select,
.export-price-box select,
.report-type-field select { width: 100%; max-width: 450px; }

.export-panel .export-brand-field,
.export-panel .export-category-field,
.export-panel .export-products-field {
  display: none;
}

.export-panel[data-scope="brand"] .export-brand-field,
.export-panel[data-scope="category"] .export-category-field,
.export-panel[data-scope="products"] .export-products-field {
  display: grid;
  grid-column: 1 / -1;
  max-width: 900px;
}

.export-products-field {
  gap: 10px;
}

.export-product-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.export-product-toolbar span {
  color: var(--muted);
  font-weight: 900;
}

.export-product-list {
  max-height: 310px;
  border-radius: 8px;
}

.export-product-list label,
.export-price-options label {
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #edf0f4;
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
  display: flex;
  align-items: center;
  gap: 10px;
}

.export-price-box h3 {
  margin: 0 0 10px;
}

.export-stock-option {
  margin-top: 10px;
  min-height: 48px;
}

.export-price-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 220px));
  gap: 10px;
  margin-top: 12px;
}

.export-price-options label {
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid #d8dfe3;
  border-radius: 8px;
  background: #fff;
  justify-content: flex-start;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.export-price-options label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(0, 173, 181, .08);
  box-shadow: 0 0 0 2px rgba(0, 173, 181, .12);
}

.export-price-options input,
.export-stock-option input { width: 17px; height: 17px; min-height: 0; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }

.export-actions {
  display: grid;
  grid-template-columns: minmax(240px, 450px) 150px;
  align-items: end;
  gap: 14px;
  margin-top: 4px;
}

.report-type-field { display: grid; gap: 7px; font-weight: 800; }
.export-run-button { min-height: 46px; border: 0; border-radius: 7px; background: var(--accent-dark); color: #fff; font-weight: 900; cursor: pointer; }
.export-run-button:hover { background: var(--ink); transform: translateY(-1px); }

.brand-manager-logo { width: 52px; height: 38px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 5px; }
.brand-logo-placeholder { width: 52px; height: 38px; display: grid; place-items: center; background: #eef2f3; border-radius: 5px; font-weight: 900; color: var(--muted); }
.brand-logo-upload { display: grid; gap: 5px; font-size: 12px; font-weight: 800; }
.mobile-menu-button,
.mobile-menu-panel { display: none; }

/* Product catalogue identity treatment */
#productsPage .filters {
  border-top: 6px solid var(--accent);
  box-shadow: inset -1px 0 0 #e2e7e9, 8px 0 24px rgba(57, 62, 70, .04);
}

#productsPage .filter-group {
  padding: 14px;
  border: 1px solid #e3e8e9;
  border-radius: 9px;
  background: rgba(0, 173, 181, .055);
}

#productsPage .filter-group:nth-of-type(even) {
  background: rgba(255, 211, 105, .12);
}

#productsPage .toolbar {
  padding: 14px 16px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 24px rgba(57, 62, 70, .14);
}

#productsPage .toolbar .muted { color: #dfe7e8; }
#productsPage #resultCount { color: var(--amber); font-weight: 900; }

#productsPage .group-title {
  border-left: 5px solid var(--accent);
  padding-left: 12px;
  color: var(--ink);
}

#productsPage .group-title span { color: var(--accent-dark); }

#productsPage .product-card {
  border-top: 4px solid var(--accent);
  box-shadow: 0 10px 26px rgba(57, 62, 70, .09);
}

#productsPage .product-card:nth-child(3n+2) { border-top-color: var(--amber); }
#productsPage .product-card:nth-child(3n) { border-top-color: var(--ink); }

#productsPage .price-chip {
  border-color: rgba(0, 173, 181, .2);
  background: rgba(0, 173, 181, .045);
}

#productsPage .card-actions .primary { background: var(--accent-dark); }
#productsPage .card-actions .primary:hover { background: var(--ink); }

.database-panel {
  align-content: start;
}

.database-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  align-items: center;
}

.sync-table-wrap {
  margin-top: 16px;
  overflow: auto;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: rgba(255,255,255,.86);
}

.sync-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.sync-table th,
.sync-table td {
  border-bottom: 1px solid #edf0f4;
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
}

.sync-table th {
  background: #f6f8fb;
  color: #555b65;
  font-weight: 900;
}

.sync-status {
  color: var(--accent);
  font-weight: 900;
}

.sync-show-more {
  margin-top: 12px;
  width: 220px;
}

.sync-schedule-note {
  margin: 10px 0 14px;
  padding: 11px 13px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #f3fafa;
  color: var(--ink);
}

.file-pick {
  min-height: 44px;
  border: 1px dashed #c9ced6;
  background: #fff;
  color: #555b65;
  display: grid;
  place-items: center;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.file-pick input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

#databaseMessage {
  min-height: 20px;
  margin-top: 12px;
}

.currency-select {
  width: 92px;
}

.user-badge {
  border: 1px solid rgba(226, 24, 18, .18);
  background: rgba(255, 255, 255, .72);
  color: var(--ink);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(22, 28, 45, .06);
}

body.not-admin .page-tabs [data-page="settings"],
body.not-admin #newProductButton {
  display: none;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pageGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes ambientSweep {
  0%, 100% { transform: translate3d(-3%, 0, 0); opacity: .45; }
  50% { transform: translate3d(3%, 0, 0); opacity: .72; }
}

@keyframes softFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(226, 24, 18, .045) 34%, transparent 52%),
    linear-gradient(300deg, transparent 0 35%, rgba(255, 182, 0, .055) 60%, transparent 82%);
  pointer-events: none;
  animation: ambientSweep 12s ease-in-out infinite;
  z-index: -1;
}

button,
.page-tabs a,
.product-card,
.tool-panel,
.page-hero,
.related-card,
.download-item {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

button:hover {
  transform: translateY(-1px);
}

.topbar {
  height: 72px;
  border-bottom: 1px solid rgba(214, 220, 229, .72);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(18px) saturate(1.18);
  box-shadow: 0 12px 34px rgba(22, 28, 45, .06);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
}

.app-logo {
  width: 56px;
  height: 46px;
  object-fit: contain;
  border: 1px solid rgba(222, 226, 232, .8);
  background: rgba(255, 255, 255, .82);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(22, 28, 45, .08);
}

.mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 900;
  position: relative;
}

.mark span {
  position: absolute;
  bottom: -7px;
  left: 5px;
  right: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  line-height: 14px;
  border-radius: 0 0 4px 4px;
  text-align: center;
}

.brand-lockup strong {
  display: block;
  font-size: 21px;
}

.brand-lockup small {
  color: var(--muted);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-pill,
.primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  min-height: 44px;
  padding: 0 24px;
  font-weight: 800;
}

.primary-pill {
  background: var(--amber);
  border-color: var(--amber);
  border-radius: 24px;
}

.ghost {
  background: #fff;
  border: 1px solid #cfd3da;
  min-height: 44px;
  padding: 0 18px;
  color: #555b65;
  font-weight: 700;
}

.danger {
  color: var(--accent);
  border-color: #f0b3b0;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: #303640;
  display: grid;
  place-items: center;
  font-size: 21px;
}

.icon-button.active {
  color: var(--accent);
  border-color: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: 334px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.filters {
  border-right: 1px solid rgba(217, 222, 230, .78);
  padding: 34px 24px;
  background: #fff;
  backdrop-filter: blur(14px);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .72);
}

.filters-title,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filters-title h2 {
  margin: 0;
  font-size: 24px;
  color: #05070a;
}

.filters-title button,
.back-link {
  border: 0;
  background: none;
  color: var(--blue);
  font-weight: 700;
}

.search-box {
  margin-top: 28px;
  height: 52px;
  border: 1px solid rgba(172, 180, 193, .86);
  display: flex;
  align-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 10px 28px rgba(22, 28, 45, .055);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}

.search-box:focus-within {
  border-color: rgba(226, 24, 18, .72);
  background: #fff;
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

.search-box input {
  border: 0;
  outline: 0;
  min-width: 0;
  flex: 1;
  padding: 0 14px;
  font-size: 17px;
}

.search-box span {
  width: 46px;
  text-align: center;
  color: #1d2635;
  font-size: 26px;
}

.filter-group {
  border-bottom: 1px solid rgba(232, 235, 240, .88);
  padding: 24px 0;
}

.filter-group h3 {
  font-size: 19px;
  margin: 0 0 18px;
  color: #202226;
}

.segmented-filter {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.segmented-filter button {
  min-height: 48px;
  border: 1px solid rgba(177, 185, 198, .92);
  background: rgba(255, 255, 255, .78);
  color: #555b65;
  font-size: 18px;
  border-radius: 5px;
  box-shadow: 0 8px 20px rgba(22, 28, 45, .045);
}

.segmented-filter button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(255, 245, 244, .86));
  box-shadow: 0 12px 28px rgba(226, 24, 18, .12);
}

.type-filter {
  display: grid;
  grid-template-columns: minmax(46px, 1fr) auto auto auto;
  gap: 12px 12px;
  align-items: center;
}

.type-filter h3 {
  margin: 0;
}

.type-filter label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #555b65;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.type-filter input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.stock-filter {
  display: grid;
  gap: 12px;
}

.stock-filter h3 {
  margin: 0;
}

.stock-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #555b65;
  font-weight: 800;
}

.stock-check input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--ok);
}

.stock-range {
  display: grid;
  gap: 8px;
  color: #555b65;
  font-weight: 800;
}

.stock-range strong {
  color: var(--accent);
}

.stock-range input[type="range"] {
  padding: 0;
  min-height: 28px;
  accent-color: var(--accent);
  cursor: pointer;
}

select, input, textarea {
  border: 1px solid #c9ced6;
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
  width: 100%;
}

textarea { resize: vertical; }

.brand-node {
  padding: 18px 0;
  border-bottom: 1px solid rgba(232, 235, 240, .88);
  animation: fadeUp .34s ease both;
}

.brand-filter {
  width: 100%;
  border: 0;
  background: rgba(255, 255, 255, .72);
  display: flex;
  justify-content: space-between;
  color: var(--accent);
  font-weight: 900;
  padding: 9px 10px;
  font-size: 16px;
  border-radius: 7px;
  transition: color .18s ease, transform .18s ease;
}

.brand-filter:hover {
  color: var(--accent-dark);
  transform: translateX(2px);
}

.brand-filter.active {
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,245,244,.84));
  box-shadow: 0 10px 24px rgba(226, 24, 18, .08);
}

.brand-logo-text {
  color: #e21812;
  font-size: 17px;
  font-style: italic;
  font-weight: 900;
  letter-spacing: 0;
  margin-top: 20px;
  opacity: .74;
  animation: softFloat 4.8s ease-in-out infinite;
}

.category-stack {
  margin-top: 16px;
}

.category-branch {
  margin: 8px 0;
}

.category-node {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  padding: 7px 8px;
  color: #22242a;
  text-align: left;
  font-size: 17px;
  font-weight: 800;
  border-radius: 5px;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.category-node:hover {
  background: rgba(255, 255, 255, .72);
  color: var(--accent);
  box-shadow: 0 8px 20px rgba(22, 28, 45, .06);
  transform: translateX(3px);
}

.subcategory-list {
  display: none;
  border-left: 2px solid #edf0f4;
  margin-left: 8px;
  padding-left: 18px;
  animation: fadeUp .22s ease both;
}

.category-branch.open > .subcategory-list {
  display: block;
}

.category-branch.active > .category-node,
.category-node:hover {
  color: var(--accent);
}

.content {
  padding: 40px 32px 72px;
  background: #fff;
}

.toolbar {
  margin-bottom: 22px;
}

.muted {
  color: var(--muted);
}

.toolbar .muted {
  margin-left: 20px;
}

.view-tools {
  display: flex;
  gap: 8px;
}

.group-block {
  margin-bottom: 34px;
  animation: fadeUp .48s ease both;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  margin: 0 0 14px;
}

.group-title span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.product-grid.list {
  grid-template-columns: 1fr;
}

.product-list-table {
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 24px rgba(22, 28, 45, .06);
}

.product-list-row {
  display: grid;
  grid-template-columns: 92px minmax(170px, 1.25fr) minmax(200px, 1.3fr) 132px minmax(150px, .95fr) 116px minmax(140px, .9fr) 132px;
  align-items: center;
  gap: 1px;
  border-bottom: 1px solid #edf0f4;
  cursor: pointer;
}

.product-list-row:last-child {
  border-bottom: 0;
}

.product-list-row > * {
  padding: 12px 14px;
  min-width: 0;
}

.product-list-head {
  background: #e5e5e5;
  color: #111827;
  font-weight: 800;
  cursor: default;
}

.product-list-row:not(.product-list-head):hover {
  background: #f8fafc;
}

.product-list-row strong {
  display: grid;
  gap: 4px;
}

.product-list-image {
  display: grid;
  place-items: center;
}

.product-list-image img {
  width: 68px;
  height: 54px;
  object-fit: contain;
  display: block;
}

.product-summary {
  color: var(--muted);
  line-height: 1.45;
}

.product-list-row .product-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-list-prices {
  display: grid;
  gap: 5px;
}

.product-list-price {
  display: grid;
  gap: 1px;
  border: 1px solid rgba(232, 235, 240, .95);
  background: #fbfcfe;
  border-radius: 5px;
  padding: 5px 7px;
}

.product-list-price small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.product-list-price strong {
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
}

.product-list-price.locked {
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.product-list-row small {
  color: var(--muted);
  font-weight: 500;
}

.product-list-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.product-list-actions button {
  min-height: 38px;
  padding: 0 12px;
}

.product-card {
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(220, 225, 232, .86);
  border-radius: 6px;
  min-height: 396px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(22, 28, 45, .055);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
  animation: fadeUp .42s ease both;
}

.product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, transparent 0 34%, rgba(255,255,255,.62) 46%, transparent 58%);
  transform: translateX(-115%);
  transition: transform .7s ease;
  pointer-events: none;
}

.product-card:hover {
  background: rgba(255, 255, 255, .96);
  border-color: rgba(226, 24, 18, .22);
  box-shadow: 0 22px 52px rgba(22, 28, 45, .13), 0 0 34px rgba(226, 24, 18, .07);
  transform: translateY(-6px);
}

.product-card:hover::before {
  transform: translateX(115%);
}

.product-card .badge,
.detail-media .badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ff8500;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  box-shadow: 0 8px 20px rgba(255, 133, 0, .22);
}

.product-card .badge-hot,
.detail-media .badge-hot {
  background: #e21c17;
  box-shadow: 0 8px 20px rgba(226, 28, 23, .24);
}

.product-card .badge-new,
.detail-media .badge-new {
  background: #159447;
  box-shadow: 0 8px 20px rgba(21, 148, 71, .22);
}

.product-card .badge-eol,
.detail-media .badge-eol {
  background: #8a909a;
  box-shadow: 0 8px 20px rgba(88, 96, 108, .18);
}

.image-count {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid rgba(226, 24, 18, .18);
  background: rgba(255, 255, 255, .88);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(22, 28, 45, .08);
}

.product-card img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  margin-top: 20px;
  transition: transform .22s ease;
}

.product-card:hover img {
  transform: scale(1.04);
}

.product-card h3 {
  text-align: left;
  font-size: 17px;
  margin: 18px 0 6px;
  min-height: 44px;
}

.product-card p {
  color: var(--muted);
  margin: 0 0 10px;
}

.product-card .product-summary {
  min-height: 42px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stock-line {
  display: flex;
  gap: 12px;
  color: #656b75;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.variant-chip,
.variant-option {
  border: 1px solid rgba(226, 24, 18, .18);
  background: rgba(255, 255, 255, .9);
  color: var(--accent);
  font-weight: 900;
  border-radius: 999px;
  padding: 4px 9px;
}

.price-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: auto;
}

.price-locked {
  grid-column: 1 / -1;
  border: 1px dashed #d7dce4;
  background: #fafbfc;
  color: var(--muted);
  padding: 12px;
  text-align: center;
  font-weight: 800;
}

.price-chip {
  border: 1px solid rgba(232, 235, 240, .9);
  background: rgba(250, 251, 252, .86);
  padding: 8px 7px;
  min-width: 0;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.product-card:hover .price-chip {
  background: #fff;
  border-color: rgba(226, 24, 18, .14);
  transform: translateY(-1px);
}

.price-chip small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-chip strong {
  display: block;
  color: var(--accent);
  font-size: 15px;
  margin-top: 2px;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.card-actions button {
  min-height: 38px;
  border-radius: 5px;
}

.card-actions .status-action {
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid #cbd1da;
  background: #f7f8fa;
  color: #4f5663;
  font-weight: 800;
  white-space: normal;
}

.card-actions .status-action.discontinue:hover {
  border-color: #e21812;
  background: #fff1f0;
  color: #c9140f;
}

.card-actions .status-action.reactivate {
  border-color: #16834a;
  background: #edf9f2;
  color: #126b3d;
}

.cost-entry-box { margin-top: 14px; padding: 16px; background: #f6f9fc; border: 1px solid #dce5ef; border-radius: 8px; }
.cost-entry-box h3 { margin: 0 0 14px; }
.cost-history-list { margin-top: 14px; max-height: 220px; overflow: auto; }
.cost-history-row { display: grid; grid-template-columns: 105px 1fr 110px; gap: 10px; padding: 9px 4px; border-top: 1px solid #dce5ef; align-items: center; }
.cost-history-row strong { color: #1f6fb2; text-align: right; }

@supports (animation-timeline: view()) {
  .group-block,
  .product-card {
    animation: none;
  }
}

/* Products must render immediately at full clarity, including on slower LAN phones. */
.product-card,
.group-block,
.brand-node {
  opacity: 1;
  animation: none;
}

.product-card {
  background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.product-card::before { display: none; }
.product-card:hover { transform: none; background: #fff; }
.product-card img { transition: none; }
.product-card:hover img { transform: none; }

.empty-state {
  color: var(--muted);
  border: 1px dashed #d6dbe3;
  padding: 22px;
  background: #fff;
}

.detail-page {
  background: #fff;
  min-height: calc(100vh - 72px);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(300px, 42%) minmax(360px, 58%);
  gap: 44px;
  padding: 48px 56px 54px;
  border-bottom: 1px solid var(--line);
}

.detail-media {
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  position: relative;
}

.detail-media img {
  max-width: min(360px, 80%);
  max-height: 360px;
  object-fit: contain;
}

.detail-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.detail-thumbs button {
  width: 58px;
  height: 58px;
  border: 1px solid #d8dde6;
  background: rgba(255, 255, 255, .86);
  padding: 4px;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(22, 28, 45, .07);
}

.detail-thumbs button.active {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(226, 24, 18, .14);
}

.detail-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-info {
  text-align: left;
}

.breadcrumb {
  color: var(--muted);
}

.detail-info h1 {
  font-size: 31px;
  margin: 18px 0 12px;
}

.subtitle {
  color: #626874;
}

.hero-prices {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin: 28px 0;
}

.variant-options {
  display: grid;
  gap: 10px;
  margin: 0 0 24px;
}

.variant-options h3 {
  margin: 0;
}

.variant-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variant-option {
  min-height: 38px;
  cursor: pointer;
}

.variant-option.active {
  background: var(--accent);
  color: #fff;
}

.hero-price {
  border: 1px solid var(--line);
  padding: 14px;
}

.hero-price small {
  color: var(--muted);
}

.hero-price strong {
  display: block;
  color: var(--accent);
  font-size: 23px;
  margin-top: 6px;
}

.detail-text-blocks {
  display: grid;
  gap: 10px;
  margin: 0 0 24px;
}

.detail-text-block {
  border: 1px solid var(--line);
  background: #fbfcfe;
  padding: 14px;
}

.detail-text-block h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--ink);
}

.detail-text-block p {
  margin: 0;
  color: #626874;
  line-height: 1.55;
}

.model-spec {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  background: var(--panel);
  padding: 18px;
  gap: 18px;
}

.model-spec dt {
  color: #8a909a;
  font-size: 12px;
}

.model-spec dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.detail-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.detail-actions a,
.detail-actions button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.anchor-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(1100px, calc(100% - 48px));
  margin: 18px auto 0;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 12px 30px rgba(22, 28, 45, .09);
}

.anchor-tabs a {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #606671;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 7px;
  font-weight: 800;
  text-align: center;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}

.anchor-tabs a:hover { background: #f3fafa; color: var(--accent-dark); }

.anchor-tabs a.active {
  background: var(--ink);
  color: #fff;
  box-shadow: inset 0 -4px 0 var(--accent);
}

.wide-section {
  padding: 48px 56px;
  scroll-margin-top: 82px;
  border-bottom: 1px solid #edf0f2;
}

.wide-section h2 {
  text-align: center;
  font-size: 30px;
  margin: 0 0 32px;
}

.spec-table,
.download-list,
.related-list {
  max-width: 980px;
  margin: 0 auto;
}

.history-group {
  max-width: 980px;
  margin: 0 auto 22px;
}

.history-group h3 {
  margin: 0 0 10px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 34px 130px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 12px 14px;
  background: #fff;
}

.history-row:last-child {
  border-bottom: 1px solid var(--line);
}

.history-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.manager-search {
  display: block;
  margin-bottom: 10px;
}

.small-dialog {
  width: min(640px, calc(100vw - 36px));
}

.network-body {
  padding: 22px;
  display: grid;
  gap: 14px;
}

.network-body code {
  display: block;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px;
  overflow-x: auto;
}

.network-links {
  display: grid;
  gap: 8px;
}

.network-links a {
  border: 1px solid var(--line);
  color: var(--blue);
  font-weight: 800;
  padding: 12px;
  text-decoration: none;
}

.order-body {
  padding: 22px;
  display: grid;
  gap: 12px;
}

.order-cart-list {
  display: grid;
  gap: 8px;
}

.order-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.3fr) 130px 44px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.order-row.order-head {
  background: var(--panel);
  color: #606671;
  font-weight: 800;
}

.order-row input {
  min-height: 38px;
  border: 1px solid #d5d9df;
  padding: 0 10px;
}

.parameter-groups {
  display: grid;
  gap: 24px;
}

.parameter-section h3 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.35;
  color: #10151f;
}

.parameter-lines {
  display: grid;
  gap: 0;
}

.parameter-line {
  display: grid;
  grid-template-columns: minmax(170px, 280px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 14px 20px;
}

.parameter-line:nth-child(odd) {
  background: #f3f3f4;
}

.parameter-line strong {
  font-weight: 500;
  color: #111827;
}

.parameter-line em {
  font-style: normal;
  color: #111827;
  line-height: 1.45;
  white-space: pre-line;
}

.compare-tool {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.compare-tool label {
  display: grid;
  gap: 7px;
  color: #555b65;
  font-weight: 800;
}

.compare-search-field,
.compare-selected-products,
.compare-product-results {
  grid-column: 1 / -1;
}

.compare-selected-products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.compare-selected-chip,
.compare-result-item {
  min-height: 56px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, .84);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
}

.compare-selected-chip strong,
.compare-result-item strong {
  display: block;
}

.compare-selected-chip small,
.compare-result-item small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.compare-product-results {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  background: rgba(246, 248, 251, .72);
}

.compare-result {
  display: grid;
  gap: 16px;
}

.compare-panel {
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.compare-panel header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: #dfe5ee;
}

.compare-panel header div {
  background: linear-gradient(135deg, #fff, #f8fafc);
  padding: 18px;
}

.compare-panel small {
  color: var(--accent);
  font-weight: 900;
}

.compare-panel h2,
.compare-panel p {
  margin: 4px 0 0;
}

.compare-table {
  display: grid;
}

.compare-row {
  display: grid;
  grid-template-columns: minmax(210px, .8fr) repeat(var(--compare-cols, 2), minmax(0, 1fr));
  gap: 1px;
  background: #e7ecf3;
  border-top: 1px solid #e7ecf3;
}

.compare-row > * {
  background: #fff;
  padding: 12px 14px;
  min-width: 0;
}

.compare-head > * {
  background: #f3f6fa;
  color: #555b65;
  font-weight: 900;
}

.compare-row.same > * {
  background: #fbfefd;
}

.compare-row.different > strong {
  background: #fff9f8;
}

.download-item {
  display: grid;
  grid-template-columns: 48px minmax(180px, 1fr) minmax(160px, 1fr) 120px;
  align-items: center;
  gap: 16px;
  border-bottom: 1px dashed #d9dde3;
  padding: 18px 0;
  text-decoration: none;
}

.download-item.disabled {
  opacity: .58;
}

.download-item .pdf {
  width: 40px;
  height: 40px;
  background: #f15b55;
  color: #fff;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 900;
  font-size: 11px;
}

.download-item small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.download-action {
  color: var(--blue);
  font-weight: 800;
  text-align: right;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.variant-list {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.variant-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  text-align: left;
}

.variant-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.variant-card small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.related-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #fff;
  text-align: center;
}

.related-card img {
  height: 100px;
  width: 100%;
  object-fit: contain;
}

.back-link {
  margin: 20px 0 0 40px;
  font-size: 16px;
}

.product-dialog,
.manage-dialog {
  width: min(1080px, calc(100vw - 36px));
  border: 0;
  padding: 0;
  box-shadow: var(--shadow);
}

.manage-dialog {
  width: min(1180px, calc(100vw - 32px));
  border-radius: 12px;
  overflow: hidden;
  background: #f5f7fb;
}

.product-dialog::backdrop,
.manage-dialog::backdrop {
  background: rgba(18, 24, 34, .34);
}

.product-dialog header,
.product-dialog footer,
.manage-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.manage-dialog header {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  padding: 20px 24px;
}

.manage-dialog .icon-button {
  border: 1px solid #dbe1ea;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(20, 31, 50, .06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.manage-dialog .icon-button:hover {
  border-color: #bcc7d6;
  box-shadow: 0 12px 24px rgba(20, 31, 50, .12);
  transform: translateY(-1px);
}

.product-dialog footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.product-dialog h2,
.manage-dialog h2 {
  margin: 0;
}

.form-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.form-tabs button {
  border: 0;
  background: #fff;
  padding: 14px 22px;
  border-bottom: 3px solid transparent;
  font-weight: 800;
}

.form-tabs button.active {
  color: var(--accent);
  border-color: var(--accent);
}

.form-body {
  max-height: 70vh;
  overflow: auto;
}

.form-panel {
  display: none;
  padding: 22px;
}

.form-panel.active {
  display: block;
}

.form-grid,
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.form-grid label,
.resource-grid label {
  display: grid;
  gap: 7px;
  color: #555b65;
  font-weight: 700;
}

.form-grid .wide,
.form-panel .wide {
  grid-column: 1 / -1;
}

.hint {
  color: var(--muted);
  margin: 0 0 12px;
}

.existing-resources {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.image-gallery-editor {
  display: grid;
  gap: 10px;
}

.image-gallery-title {
  font-weight: 900;
  color: #343841;
}

.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.image-gallery-item {
  border: 1px solid #dfe5ee;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 7px;
  box-shadow: 0 8px 18px rgba(22, 28, 45, .05);
}

.image-gallery-item img {
  width: 100%;
  height: 86px;
  object-fit: contain;
}

.image-gallery-item span {
  color: #555b65;
  font-size: 12px;
  font-weight: 800;
}

.image-gallery-item input {
  width: auto;
  min-height: auto;
  justify-self: start;
}

.image-delete-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.new-file-item {
  align-content: center;
}

.new-file-item small {
  color: var(--muted);
}

.new-file-item button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 5px;
}

.existing-resources div {
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  grid-template-columns: 1fr 140px 1fr;
  gap: 12px;
  padding: 12px;
}

.related-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.related-option {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 6px 10px;
  align-items: center;
}

.related-option input {
  width: auto;
  min-height: auto;
}

.related-option small {
  grid-column: 2;
  color: var(--muted);
}

.spec-editor {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.spec-row {
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(160px, .9fr) minmax(180px, 1fr) minmax(220px, 1.4fr) 42px;
  gap: 10px;
  align-items: end;
  box-shadow: 0 8px 20px rgba(22, 28, 45, .05);
}

.spec-row label {
  display: grid;
  gap: 6px;
  color: #555b65;
  font-weight: 800;
}

.spec-row .spec-section {
  grid-column: 1 / -1;
}

.spec-row [data-remove-spec] {
  align-self: end;
}

#formMessage {
  color: var(--ok);
  margin-left: auto;
}

.manage-body {
  display: grid;
  grid-template-columns: minmax(340px, .85fr) minmax(560px, 1.45fr);
  gap: 18px;
  padding: 18px;
  max-height: 72vh;
  overflow: auto;
  background:
    radial-gradient(circle at 10% 0%, rgba(226, 28, 23, .08), transparent 26%),
    linear-gradient(180deg, #f7f9fc 0%, #f2f5f9 100%);
}

.manage-body h3 {
  margin: 0 0 14px;
  font-size: 18px;
  letter-spacing: 0;
}

.manager-panel {
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 18px 40px rgba(21, 30, 45, .07);
  padding: 16px;
  min-width: 0;
}

.inline-editor {
  display: grid;
  grid-template-columns: 1fr 120px 120px 130px;
  gap: 8px;
  margin-bottom: 16px;
}

.category-editor {
  grid-template-columns: 140px 160px 1fr 80px 145px;
}

.manage-body .inline-editor {
  border: 1px solid #dfe5ee;
  border-radius: 9px;
  background: #fbfcfe;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  padding: 12px;
  margin-bottom: 14px;
}

.manage-body .inline-editor input,
.manage-body .inline-editor select {
  min-height: 44px;
  border-color: #ccd4df;
  background: #fff;
}

.brand-manager-panel .inline-editor {
  grid-template-columns: 1fr 1fr;
}

.brand-manager-panel .manager-row {
  grid-template-columns: 52px minmax(0, 1fr) 78px 86px;
}

.brand-manager-panel .inline-editor #brandNameInput,
.brand-manager-panel .inline-editor button {
  grid-column: 1 / -1;
}

.category-manager-panel .manager-search {
  margin-bottom: 10px;
}

.category-manager-panel .category-editor {
  grid-template-columns: 1fr 1fr;
}

.category-manager-panel .category-editor #categoryNameInput {
  grid-column: 1 / -1;
}

.category-manager-panel .category-editor #categorySortInput {
  max-width: 130px;
}

.category-manager-panel .category-editor button {
  justify-self: end;
  min-width: 170px;
}

.manager-list {
  display: grid;
  gap: 10px;
}

.manager-row {
  border: 1px solid #e0e6ef;
  border-radius: 8px;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 86px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(23, 31, 48, .04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.trash-row {
  grid-template-columns: minmax(0, 1fr);
}

.manager-row:hover,
.related-card:hover,
.tool-panel:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.manager-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.manager-row button {
  min-height: 38px;
  border: 1px solid #cfd3da;
  border-radius: 5px;
  background: #fff;
  font-weight: 800;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.manager-row button:hover {
  transform: translateY(-1px);
}

.manager-row [data-edit-brand],
.manager-row [data-edit-category] {
  color: #1e5f9f;
  border-color: #c8d9ee;
  background: #f7fbff;
}

.manager-row [data-edit-brand]:hover,
.manager-row [data-edit-category]:hover {
  border-color: #8db7e7;
  background: #eef6ff;
}

.manager-row [data-delete-brand],
.manager-row [data-delete-category] {
  color: var(--accent);
  border-color: #efc5c3;
  background: #fff8f7;
}

.manager-row [data-delete-brand]:hover,
.manager-row [data-delete-category]:hover {
  border-color: #e21c17;
  background: #fff0ef;
}

@media (max-width: 980px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 12px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .top-actions {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .database-actions {
    grid-template-columns: 1fr;
  }

  .layout,
  .detail-hero,
  .manage-body,
  .settings-grid,
  .user-editor {
    grid-template-columns: 1fr;
  }

  .filters {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 24px 18px;
  }

  .content {
    padding: 24px 14px 48px;
  }

  .detail-hero {
    padding: 24px 18px;
  }

  .detail-media {
    min-height: 280px;
  }

  .hero-prices,
  .model-spec,
  .detail-actions,
  .form-grid,
  .resource-grid,
  .inline-editor,
  .category-editor {
    grid-template-columns: 1fr;
  }

  .manage-dialog {
    width: min(760px, calc(100vw - 20px));
  }

  .manage-body {
    padding: 12px;
    max-height: calc(100vh - 112px);
  }

  .manager-panel {
    padding: 12px;
  }

  .brand-manager-panel .inline-editor,
  .category-manager-panel .category-editor {
    grid-template-columns: 1fr;
  }

  .spec-row {
    grid-template-columns: 1fr;
  }

  .spec-row .spec-section {
    grid-column: auto;
  }

  .brand-manager-panel .inline-editor #brandNameInput,
  .brand-manager-panel .inline-editor button,
  .category-manager-panel .category-editor #categoryNameInput {
    grid-column: auto;
  }

  .category-manager-panel .category-editor #categorySortInput {
    max-width: none;
  }

  .category-manager-panel .category-editor button {
    justify-self: stretch;
    min-width: 0;
  }

  .wide-section {
    padding: 32px 18px;
  }

  .parameter-row,
  .parameter-line,
  .order-row,
  .compare-tool,
  .compare-panel header,
  .compare-row,
  .download-item,
  .history-row,
  .existing-resources div,
  .manager-row {
    grid-template-columns: 1fr;
  }

  .download-action {
    text-align: left;
  }
}

@media (max-width: 760px) {
  :root {
    --mobile-header: 62px;
    --mobile-tabs: 74px;
    --mobile-pad: 12px;
  }

  html,
  body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    background:
      radial-gradient(circle at 10% -10%, rgba(226, 24, 18, .14), transparent 28%),
      radial-gradient(circle at 90% 6%, rgba(24, 132, 211, .12), transparent 24%),
      linear-gradient(145deg, #fbfcfe, #f4f7fb 48%, #fff7f5);
  }

  body::before {
    opacity: .9;
  }

  .anchor-tabs {
    width: calc(100% - 24px);
    grid-template-columns: repeat(5, minmax(112px, 1fr));
    overflow-x: auto;
    justify-content: start;
    top: 0;
    margin-top: 10px;
    scrollbar-width: thin;
  }

  .anchor-tabs a { font-size: 12px; white-space: nowrap; }
  .wide-section { scroll-margin-top: 74px; }

  .topbar {
    position: fixed;
    inset: 0 0 auto;
    height: calc(var(--mobile-header) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) var(--mobile-pad) 7px;
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    border-bottom: 1px solid rgba(255, 255, 255, .72);
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 8px 22px rgba(22, 28, 45, .08);
    backdrop-filter: none;
    z-index: 60;
  }

  .brand-lockup {
    min-height: 46px;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .brand-lockup .app-logo {
    width: 46px;
    height: 38px;
    border-radius: 7px;
    padding: 3px;
    box-shadow: 0 6px 14px rgba(22, 28, 45, .07);
  }

  .brand-lockup strong {
    display: block;
    max-width: 126px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }

  .brand-lockup small,
  #networkButton,
  #userBadge {
    display: none;
  }

  .top-actions {
    width: auto;
    margin-left: auto;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 5px;
  }

  .currency-select {
    width: 54px;
    min-width: 54px;
    padding: 0 6px;
    font-size: 12px;
  }

  #orderButton,
  #logoutButton,
  #newProductButton {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    height: 42px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
    line-height: 42px;
    white-space: nowrap;
    position: relative;
  }

  #refreshButton {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    height: 42px;
    padding: 0;
  }

  #orderButton::before {
    content: "Cart";
  }

  #logoutButton::before {
    content: "Out";
  }

  #newProductButton::before {
    content: "+";
    font-size: 22px;
  }

  #orderButton::before,
  #logoutButton::before,
  #newProductButton::before {
    color: var(--ink);
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 11px;
  }

  #newProductButton::before {
    color: #fff;
    font-size: 22px;
  }

  .page-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--mobile-tabs) + env(safe-area-inset-bottom));
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    background: rgba(255, 255, 255, .82);
    border-top: 1px solid rgba(255, 255, 255, .76);
    box-shadow: 0 -16px 34px rgba(22, 28, 45, .12);
    backdrop-filter: blur(18px) saturate(1.18);
    z-index: 70;
  }

  .page-tabs a {
    min-width: 0;
    min-height: 46px;
    padding: 0 4px;
    border: 1px solid transparent;
    border-radius: 8px;
    justify-content: center;
    text-align: center;
    font-size: 12px;
  }

  .page-tabs a.active {
    border-color: rgba(226, 24, 18, .28);
    background: linear-gradient(135deg, rgba(226, 24, 18, .12), rgba(255, 182, 0, .1));
    box-shadow: 0 8px 22px rgba(226, 24, 18, .12);
  }

  .app-page,
  .app-page.active {
    position: fixed;
    top: calc(var(--mobile-header) + env(safe-area-inset-top));
    bottom: calc(var(--mobile-tabs) + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: none !important;
    min-height: 0;
    padding-bottom: 18px;
    scroll-behavior: smooth;
  }

  .app-page.active {
    display: block !important;
    animation: mobilePageIn .24s ease both;
  }

  .layout {
    background: transparent;
  }

  .filters,
  .content,
  .page-shell,
  .product-page-shell,
  .detail-page {
    padding-left: var(--mobile-pad);
    padding-right: var(--mobile-pad);
  }

  .filters {
    display: contents;
    padding-top: 12px;
    padding-bottom: 16px;
    border: 0;
    background: transparent;
    max-height: none;
    overflow: visible;
  }

  .filters-title,
  .search-box,
  .filter-group,
  .brand-tree,
  .toolbar,
  .tool-panel,
  .page-hero,
  .product-card,
  .detail-hero,
  .spec-card,
  .download-item,
  .manager-row {
    border-radius: 8px;
  }

  .search-box,
  .filter-group,
  .toolbar,
  .tool-panel,
  .page-hero {
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(14px) saturate(1.08);
    box-shadow: 0 14px 34px rgba(22, 28, 45, .08);
  }

  .filter-group,
  .brand-tree {
    padding: 12px;
  }

  .brand-tree {
    display: none;
  }

  .filters-title {
    display: flex;
    align-items: center;
    padding: 0 2px 8px;
    margin: 12px var(--mobile-pad) 0;
    box-shadow: none;
    background: transparent;
  }

  .filters-title h2 {
    font-size: 22px;
  }

  .filters-title button {
    min-height: 38px;
    padding: 0 8px;
  }

  .search-box {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 var(--mobile-pad) 10px;
    border: 1px solid #cbd2dc;
    background: rgba(255, 255, 255, .96);
  }

  .search-box input {
    font-size: 16px;
  }

  .type-filter {
    display: grid;
    grid-template-columns: minmax(46px, 1fr) auto auto auto;
    align-items: center;
    gap: 7px;
  }

  .type-filter h3 {
    margin: 0;
  }

  .type-filter label {
    min-height: 38px;
    padding: 0 4px;
    font-size: 13px;
  }

  .filter-group h3 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .filter-group {
    margin-left: var(--mobile-pad);
    margin-right: var(--mobile-pad);
    margin-bottom: 10px;
  }

  .content {
    padding-top: 8px;
    padding-bottom: 22px;
  }

  .toolbar {
    position: static;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .74);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .toolbar > div:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }

  .toolbar #resultCount {
    font-size: 16px;
    font-weight: 900;
    line-height: 1.25;
  }

  .toolbar .muted {
    max-width: 156px;
    text-align: right;
    font-size: 12px;
    line-height: 1.25;
  }

  .view-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px 46px;
    gap: 8px;
  }

  .page-size-control {
    justify-content: space-between;
    min-height: 44px;
  }

  .page-size-control select {
    min-height: 36px;
  }

  .grouped-products {
    gap: 18px;
  }

  .product-grid,
  .product-grid.list {
    grid-template-columns: 1fr;
  }

  .product-list-table {
    border: 0;
    background: transparent;
    box-shadow: none;
    display: grid;
    gap: 10px;
  }

  .product-list-head {
    display: none;
  }

  .product-list-row {
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid #dfe5ee;
    border-radius: 8px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 10px 24px rgba(22, 28, 45, .07);
    overflow: hidden;
  }

  .product-list-row > * {
    padding: 8px 12px;
  }

  .product-list-image {
    justify-content: flex-start;
  }

  .product-list-image img {
    width: 96px;
    height: 76px;
  }

  .product-list-row > span:nth-child(3)::before {
    content: "Summary: ";
    color: var(--muted);
    font-weight: 900;
  }

  .product-list-row > span:nth-child(4)::before {
    content: "Material Code: ";
    color: var(--muted);
    font-weight: 900;
  }

  .product-list-row > span:nth-child(5)::before {
    content: "Prices: ";
    color: var(--muted);
    font-weight: 900;
  }

  .product-list-row > span:nth-child(6)::before {
    content: "Brand: ";
    color: var(--muted);
    font-weight: 900;
  }

  .product-list-row > span:nth-child(7)::before {
    content: "Category: ";
    color: var(--muted);
    font-weight: 900;
  }

  .product-list-actions {
    justify-content: stretch;
  }

  .product-list-actions button {
    flex: 1;
    min-height: 48px;
  }

  button,
  .primary,
  .ghost,
  .primary-pill,
  input,
  select,
  textarea,
  .file-pick,
  .card-actions button,
  .type-filter label,
  .brand-node,
  .category-node,
  .download-item,
  .manager-row button {
    min-height: 48px;
  }

  .icon-button,
  .view-tools .icon-button {
    width: 48px;
    min-width: 48px;
  }

  #newProductButton {
    height: 48px;
    min-height: 48px;
  }

  .top-actions .currency-select,
  .top-actions #refreshButton,
  .top-actions #orderButton,
  .top-actions #logoutButton,
  .top-actions #newProductButton {
    height: 42px;
    min-height: 42px;
  }

  input,
  select,
  textarea,
  .search-box {
    border-radius: 8px;
  }

  .page-shell {
    min-height: 0;
    padding-top: 18px;
    gap: 14px;
  }

  .page-hero {
    padding: 18px;
  }

  .page-hero h1 {
    font-size: 24px;
  }

  .tool-panel {
    padding: 16px;
  }

  .database-actions,
  .export-actions,
  .export-scope-tabs,
  .export-price-options,
  .export-fields,
  .detail-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand-manager-panel .manager-row {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .sync-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .sync-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .sync-table thead {
    display: none;
  }

  .sync-table,
  .sync-table tbody,
  .sync-table tr,
  .sync-table td {
    display: block;
    width: 100%;
  }

  .sync-table tr {
    padding: 12px;
    border: 1px solid rgba(223, 229, 238, .95);
    border-radius: 8px;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 10px 24px rgba(22, 28, 45, .07);
  }

  .sync-table td {
    display: grid;
    grid-template-columns: 126px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    border: 0;
    padding: 7px 0;
    font-size: 13px;
    word-break: break-word;
  }

  .sync-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 900;
  }

  .sync-table td:first-child {
    font-size: 15px;
    font-weight: 900;
  }

  .sync-show-more {
    width: 100%;
  }

  .detail-hero,
  .hero-prices,
  .model-spec,
  .variant-list,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .parameter-groups {
    gap: 18px;
  }

  .parameter-section h3 {
    font-size: 16px;
  }

  .parameter-line {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 14px;
  }

  .detail-media {
    min-height: 230px;
  }

  .dialog-card,
  .manage-dialog,
  .order-dialog {
    width: min(100vw - 18px, 760px);
    max-height: calc(100vh - 24px);
    border-radius: 8px;
  }
}

@media (max-width: 760px) {
  :root { --mobile-tabs: 0px; }

  body { background: #fff; }

  .topbar {
    height: calc(68px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 8px;
    border-bottom: 4px solid var(--accent);
  }

  .page-tabs { display: none !important; }

  .top-actions > :not(.currency-select):not(.mobile-menu-button) {
    display: none !important;
  }

  .mobile-menu-button {
    width: 56px;
    min-width: 56px;
    height: 46px;
    min-height: 46px;
    padding: 7px 9px 5px;
    border: 1px solid #d7dfe2;
    border-radius: 8px;
    background: #fff;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
    place-content: center;
    color: var(--ink);
  }

  .mobile-menu-button span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 0 auto;
    border-radius: 9px;
    background: var(--accent-dark);
  }

  .mobile-menu-button b { font-size: 9px; line-height: 10px; }

  .mobile-menu-panel {
    position: fixed;
    top: calc(68px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    max-height: calc(100dvh - 82px - env(safe-area-inset-top));
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #dce3e5;
    border-top: 4px solid var(--amber);
    border-radius: 0 0 12px 12px;
    background: #fff;
    box-shadow: 0 22px 50px rgba(57, 62, 70, .22);
    z-index: 100;
  }

  body.mobile-menu-open .mobile-menu-panel { display: grid; gap: 14px; }

  .mobile-page-list,
  .mobile-action-list { display: grid; gap: 7px; }

  .mobile-page-list a,
  .mobile-action-list button {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid #e0e6e8;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-align: left;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
  }

  .mobile-page-list a.active {
    border-color: var(--accent);
    background: rgba(0, 173, 181, .09);
    color: var(--accent-dark);
    box-shadow: inset 4px 0 0 var(--accent);
  }

  .mobile-action-list {
    padding-top: 12px;
    border-top: 1px solid #e4e9ea;
    grid-template-columns: 1fr 1fr;
  }

  .mobile-action-list button { background: rgba(255, 211, 105, .11); }
  body.not-admin .mobile-action-list [data-mobile-action="new"] { display: none; }

  .app-page,
  .app-page.active {
    top: calc(68px + env(safe-area-inset-top));
    bottom: 0;
  }

  body.mobile-menu-open .app-page { filter: brightness(.92); pointer-events: none; }

  .brand-lockup strong { max-width: 155px; font-size: 14px; }
  .currency-select { width: 58px; min-width: 58px; height: 46px; }

  #productsPage .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  #productsPage .toolbar > div,
  #productsPage .view-tools { width: 100%; }
  #productsPage .view-tools { justify-content: space-between; }

  .page-shell { padding: 14px 12px 28px; }
  .page-hero { padding: 18px; }
  .tool-panel { padding: 15px; }
  .export-scope-tabs { width: 100%; }
  .export-actions { grid-template-columns: 1fr; }
  .export-run-button { width: 100%; }
}

@keyframes mobilePageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.not-admin .admin-only { display: none !important; }
