: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,
.nav-dropdown-trigger {
  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,
.nav-dropdown.active > .nav-dropdown-trigger {
  color: var(--accent);
  border-color: var(--accent);
}

.nav-dropdown { position: relative; display: flex; align-items: stretch; }
.nav-dropdown-trigger { cursor: pointer; font: inherit; }
.nav-dropdown-trigger span { margin-left: 7px; font-size: 11px; transition: transform .18s ease; }
.nav-dropdown.open .nav-dropdown-trigger span { transform: rotate(180deg); }
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  z-index: 120;
  display: none;
  min-width: 270px;
  padding: 8px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 0 0 9px 9px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(57, 62, 70, .18);
}
.nav-dropdown.open .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: grid; }
.nav-dropdown-menu a {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible,
.nav-dropdown-menu a.active { color: var(--accent); background: var(--accent-soft, #edfafa); }

.analysis-method-note { max-width: 820px; padding: 9px 12px; border-inline-start: 3px solid var(--accent); background: #f3fafa; border-radius: 5px; }

.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;
}

.product-map-panel { grid-column:1 / -1; min-width:0; overflow:hidden; }
.product-map-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.product-map-heading h2 { margin:0 0 6px; color:#17324d; }
.product-map-heading p { margin:0; }
.product-map-stats { display:flex; flex-wrap:wrap; gap:8px; }
.product-map-stats span { display:inline-flex; align-items:center; gap:6px; padding:8px 11px; border-radius:999px; background:#e8f6f6; color:#276268; font-size:12px; white-space:nowrap; }
.product-map-stats b { font-size:15px; }
.product-map-toolbar { display:grid; grid-template-columns:minmax(170px,230px) minmax(220px,1fr) auto; align-items:end; gap:10px; margin:18px 0; }
.product-map-toolbar label { display:grid; gap:5px; min-width:0; color:#526575; font-size:12px; font-weight:800; }
.product-map-toolbar input,.product-map-toolbar select { width:100%; min-width:0; }
.product-map-viewport { max-width:100%; min-height:460px; max-height:75vh; overflow:auto; border:1px solid #cfe1e4; border-radius:14px; background:radial-gradient(circle at 50% 45%,#f5fcfb 0,#f8fbfc 42%,#edf4f7 100%); direction:ltr; scrollbar-width:thin; }
.product-mind-map { display:grid; grid-template-columns:minmax(390px,1fr) 220px minmax(390px,1fr); align-items:stretch; gap:0; min-width:1100px; min-height:460px; padding:32px 24px; direction:ltr; }
.product-map-side { position:relative; display:flex; flex-direction:column; justify-content:center; gap:14px; min-width:0; padding:20px 26px; }
.product-map-side::before { content:""; position:absolute; top:47px; bottom:47px; width:3px; border-radius:4px; background:#a8d8d8; }
.product-map-side-left::before { right:0; }
.product-map-side-right::before { left:0; }
.product-map-branch { position:relative; display:flex; flex-direction:column; min-width:0; }
.product-map-branch.left { align-items:flex-end; }
.product-map-branch.right { align-items:flex-start; }
.product-map-branch::before { content:""; position:absolute; top:23px; width:26px; height:2px; background:#a8d8d8; }
.product-map-branch.left::before { right:-26px; }
.product-map-branch.right::before { left:-26px; }
.product-map-node { display:flex; align-items:center; justify-content:space-between; gap:8px; width:min(100%,300px); min-height:46px; padding:10px 12px; border:1px solid #bed9dc; border-radius:12px; background:#fff; color:#17324d; box-shadow:0 5px 14px #17324d12; font-size:13px; font-weight:800; text-align:start; text-decoration:none; direction:rtl; cursor:pointer; }
.product-map-node:hover,.product-map-node:focus-visible { border-color:#078f91; box-shadow:0 0 0 3px #08a6a624; }
.product-map-node:disabled { cursor:default; opacity:1; }
.product-map-brand>.product-map-node { background:linear-gradient(135deg,#153752,#087f87); border-color:#117e85; color:#fff; }
.product-map-category>.product-map-node { border-inline-start:4px solid #08a6a6; }
.product-map-product { background:#f8fbff; border-color:#d8e4ec; font-size:12px; }
.product-map-node-label { display:block; min-width:0; overflow-wrap:anywhere; }
.product-map-node-meta { display:inline-flex; align-items:center; gap:7px; flex-shrink:0; white-space:nowrap; }
.product-map-node-meta small { font-size:10px; font-weight:700; opacity:.8; }
.product-map-node-meta b { display:grid; place-items:center; width:20px; height:20px; border-radius:50%; background:#ffffff40; font-size:16px; }
.product-map-category .product-map-node-meta b { background:#e4f5f4; color:#087f87; }
.product-map-product small { flex-shrink:0; max-width:115px; overflow-wrap:anywhere; color:#6a7b8b; font-size:10px; }
.product-map-children { display:flex; flex-direction:column; gap:8px; width:calc(100% - 22px); margin-top:8px; padding:0 0 0 12px; }
.product-map-branch.left>.product-map-children { margin-right:22px; border-right:2px solid #c4dfdf; }
.product-map-branch.right>.product-map-children { margin-left:22px; border-left:2px solid #c4dfdf; }
.product-map-children .product-map-branch::before { top:22px; }
.product-map-children .product-map-branch.left::before { right:-12px; width:12px; }
.product-map-children .product-map-branch.right::before { left:-12px; width:12px; }
.product-map-center { display:flex; align-items:center; justify-content:center; position:relative; }
.product-map-center::before { content:""; position:absolute; top:50%; left:0; right:0; height:3px; background:#8ccaca; }
.product-map-root { position:relative; z-index:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; width:190px; min-height:130px; padding:18px; border:5px solid #fff; border-radius:28px; background:linear-gradient(145deg,#0aa5a6,#16637b); color:#fff; box-shadow:0 10px 28px #0b657b38; text-align:center; direction:rtl; }
.product-map-root-icon { font-size:25px; line-height:1; }
.product-map-root strong { font-size:20px; }
.product-map-root small { font-size:11px; opacity:.9; }
.product-map-note { margin:12px 0 0; }
@media(max-width:800px) { .product-map-heading { flex-direction:column; } .product-map-toolbar { grid-template-columns:1fr 1fr; } .product-map-toolbar button { grid-column:1/-1; } }
@media(max-width:520px) { .product-map-toolbar { grid-template-columns:1fr; } .product-map-toolbar button { grid-column:auto; } .product-map-viewport { max-height:66vh; } }

.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,
.mobile-filter-toggle,
.mobile-filter-close,
.mobile-apply-filters,
.mobile-quick-search { 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,
body.not-admin #orderButton,
body.not-admin [data-order],
body.not-admin .order-detail,
body.not-admin .mobile-action-list [data-mobile-action="orders"] {
  display: none;
}

body.no-export .export-only { display: none !important; }

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);
}

.catalog-number { display: block; padding: 0; color: #526579; font: 700 12px monospace; }
.product-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 28px; }
.product-card .product-card-meta > .badge,
.product-card .product-card-meta > .image-count { position: static; flex: 0 0 auto; max-width: 100%; overflow-wrap: anywhere; }
.product-card-meta .catalog-number { flex: 0 0 auto; }
.product-card .product-card-meta > .image-count { margin-inline-start: auto; }
.product-card { content-visibility: auto; contain-intrinsic-size: auto 510px; }

.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;
}

.app-back-button {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 54px;
  height: 46px;
  padding: 4px 8px;
  border: 1px solid #d7dfe2;
  border-radius: 9px;
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 6px 16px rgba(22, 28, 45, .08);
}

.app-back-button span { font-size: 32px; line-height: 24px; font-weight: 400; }
.app-back-button b { font-size: 11px; }

.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 86px 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.admin-cost-price,
.price-chip.admin-cost-price,
.hero-price.admin-cost-price {
  border-color: rgba(22, 101, 52, .28);
  background: #f2faf5;
}

.product-list-price.admin-cost-price strong,
.price-chip.admin-cost-price strong,
.hero-price.admin-cost-price strong {
  color: #166534;
}

.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);
}

.available-stock-with-level { display:inline-flex; align-items:center; gap:6px; }
.available-stock-with-level .level-badge { width:22px; height:22px; border-radius:6px; font-size:11px; line-height:1; box-shadow:0 3px 8px rgba(16,35,38,.16); }
.stock-level-options { display:grid; grid-template-columns:1.25fr repeat(4,1fr); gap:5px; margin-top:8px; }
.stock-level-options button { min-width:0; height:34px; padding:0; border:1px solid #cbd7d9; border-radius:7px; background:#fff; color:var(--ink); font-weight:900; cursor:pointer; }
.stock-level-options button:hover { border-color:var(--accent); color:var(--accent-dark); }
.stock-level-options button.active { border-color:var(--accent); background:var(--accent); color:#fff; box-shadow:0 4px 10px rgba(0,159,164,.2); }
.stock-level-options button[data-catalog-level="A"]:not(.active) { color:#258a52; }
.stock-level-options button[data-catalog-level="B"]:not(.active) { color:#2878b5; }
.stock-level-options button[data-catalog-level="C"]:not(.active) { color:#d77b16; }
.stock-level-options button[data-catalog-level="D"]:not(.active) { color:#bd3f43; }

.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;
}

.detail-stock-analysis {
  display: grid;
  gap: 12px;
  margin: 18px 0 4px;
  padding: 16px;
  border: 1px solid #d7e5e6;
  border-inline-start: 3px solid var(--accent);
  border-radius: 10px;
  background: #f3fafa;
}
.detail-stock-analysis[hidden] { display: none; }

.anchor-tabs a[hidden],
.wide-section[hidden] {
  display: none !important;
}
.detail-analysis-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-analysis-heading h2 { margin: 0; }
.stock-analysis-source { color: var(--accent-dark); font-weight: 800; }
.detail-analysis-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.detail-analysis-grid > div { padding: 10px; border: 1px solid #dce7e8; border-radius: 8px; background: #fff; }
.detail-analysis-grid small,
.stock-analysis-reason-block > small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
.detail-analysis-grid strong { display: block; margin-top: 4px; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.stock-analysis-reason-block { padding-top: 10px; border-top: 1px solid #d9e5e6; }
.stock-analysis-reason { margin: 5px 0 0; color: var(--ink); line-height: 1.6; }

.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, minmax(0, 1fr));
    gap: 6px;
    margin-top: auto;
  }

  .price-update-period {
    grid-column: 1 / -1;
    justify-self: end;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
  }

.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;
  overflow: hidden;
  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;
  min-width: 0;
  max-width: 100%;
}

.currency-value {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.currency-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 3px 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.currency-usd .currency-badge {
  border-color: #b7cdf2;
  background: #eaf2ff;
  color: #174ea6;
}

.currency-iqd .currency-badge {
  border-color: #b8ddc4;
  background: #e9f7ee;
  color: #166534;
}

.currency-amount {
  min-width: 0;
  max-width: 100%;
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.product-list-price .currency-value,
.price-chip .currency-value,
.hero-price .currency-value {
  display: flex;
}

.price-chip .currency-value {
  flex-wrap: wrap;
}

.price-chip .currency-amount {
  overflow-wrap: anywhere;
}

.price-row .admin-cost-price {
  grid-column: 1 / -1;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(5, 42px);
  gap: 7px;
  justify-content: start;
  margin-top: 12px;
}

.card-actions button {
  min-height: 38px;
  border-radius: 5px;
}

.card-actions .compact-action,
.product-list-actions .compact-action {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  border: 1px solid #d8dfe8;
  border-radius: 9px;
  background: #fff;
  color: #4f5663;
}

.card-actions .detail-action {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}

.card-actions .detail-action:hover {
  border-color: var(--ink);
  background: var(--ink);
}

.card-actions .action-icon {
  width: 19px;
  height: 19px;
  display: block;
  margin: auto;
}

.card-actions .detail-action .action-icon {
  filter: brightness(0) invert(1);
}

.card-actions .order-action,
.product-list-actions .order-action {
  color: var(--accent-dark);
  border-color: rgba(0, 173, 181, .35);
  background: #f0fbfb;
}

.card-actions .edit-action,
.product-list-actions .edit-action {
  color: #2878b5;
  border-color: #cfe1f1;
  background: #f3f8fd;
}

.card-actions .status-action {
  border: 1px solid #cbd1da;
  background: #f7f8fa;
  color: #4f5663;
  font-weight: 800;
}

.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 auto; 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-page > .back-link {
  margin: 24px max(18px, calc((100% - 1440px) / 2)) 0;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(320px, 2fr) minmax(560px, 3fr);
  gap: clamp(32px, 4vw, 64px);
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;
  padding: 48px 0 54px;
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.detail-media {
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  position: relative;
  padding: 36px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, #fff 0%, #f7fafb 100%);
}

.download-product-image {
  position: static;
  transform: none;
  width: min(100%, 280px);
  min-height: 46px;
  border: 1px solid rgba(0, 173, 181, .28);
  border-radius: 9px;
  background: linear-gradient(180deg, #00adb5, #078f96);
  color: #fff;
  box-shadow: 0 14px 30px rgba(0, 173, 181, .2);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  text-decoration: none;
  z-index: 3;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.download-product-image span {
  font-size: 22px;
  line-height: 1;
}

.download-product-image strong {
  font-size: 13px;
  line-height: 1.25;
  writing-mode: horizontal-tb;
  transform: none;
  letter-spacing: .1px;
}

.download-product-image:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #04bbc4, #007f86);
  box-shadow: 0 18px 36px rgba(0, 173, 181, .3);
}

.detail-media img {
  max-width: min(440px, 92%);
  max-height: 410px;
  object-fit: contain;
}

.detail-media > img {
  cursor: zoom-in;
  border-radius: 10px;
  transition: filter .15s ease, outline-color .15s ease;
}

.detail-media > img:hover,
.detail-media > img:focus-visible {
  filter: drop-shadow(0 12px 18px rgba(32, 52, 66, .16));
  outline: 3px solid rgba(0, 173, 181, .3);
  outline-offset: 8px;
}

.product-image-viewer {
  width: min(94vw, 1200px);
  height: min(92vh, 900px);
  padding: 54px 24px 20px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(20, 30, 40, .38);
  overflow: hidden;
}

.product-image-viewer::backdrop { background: rgba(25, 32, 40, .82); }
.product-image-viewer img { width: 100%; height: calc(100% - 32px); object-fit: contain; }
.product-image-viewer p { margin: 8px 50px 0; text-align: center; color: var(--text); font-weight: 700; }
.product-image-viewer-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #393e46;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.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(auto-fit, 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;
}

.history-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -16px 0 24px;
}

.history-popup-actions button {
  min-height: 38px;
  padding: 8px 14px;
}

.hero-price.admin-cost-price span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.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 {
  --active-index: 0;
  position: relative;
  z-index: 20;
  width: min(1100px, calc(100% - 48px));
  margin: 18px auto 0;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(4, 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);
  isolation: isolate;
}

.anchor-tabs::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 7px;
  bottom: 7px;
  left: 7px;
  width: calc((100% - 32px) / 4);
  border-radius: 7px;
  background: var(--ink);
  box-shadow: inset 0 -4px 0 var(--accent), 0 5px 14px rgba(22, 28, 45, .12);
  transform: translateX(calc(var(--active-index) * (100% + 6px)));
  transition: transform .38s cubic-bezier(.22, 1, .36, 1);
  pointer-events: none;
}

.anchor-tabs a {
  position: relative;
  z-index: 1;
  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: color .25s ease, transform .25s ease;
}

.anchor-tabs a:hover { color: var(--accent-dark); transform: translateY(-1px); }

.anchor-tabs a.active {
  color: #fff;
}

.anchor-tabs a.active:hover { color: #fff; }

.wide-section {
  padding: 48px 56px;
  scroll-margin-top: 154px;
  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;
}

.history-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(78vh, 720px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(17, 24, 39, .28);
}

.history-dialog::backdrop {
  background: rgba(10, 18, 28, .58);
}

.history-dialog > header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.history-dialog > header h2 {
  margin: 0;
  font-size: 21px;
}

.history-dialog-content {
  max-height: calc(min(78vh, 720px) - 70px);
  overflow: auto;
  padding: 18px;
}

.history-dialog-content .history-group:last-child {
  margin-bottom: 0;
}

.cost-popup-list {
  display: grid;
  gap: 10px;
}

.cost-popup-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid rgba(22, 101, 52, .22);
  border-radius: 6px;
  background: #fff;
}

.cost-popup-row span {
  display: grid;
  gap: 4px;
}

.cost-popup-row small {
  color: var(--muted);
}

.cost-popup-row > strong {
  color: #166534;
  white-space: nowrap;
}

.cost-popup-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.manager-search {
  display: block;
  margin-bottom: 10px;
}

.small-dialog {
  width: min(640px, calc(100vw - 36px));
}

.network-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(900px, calc(100vh - 28px));
}

.network-body {
  padding: 22px;
  display: grid;
  gap: 16px;
  overflow-y: auto;
}

.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(--ink);
  padding: 12px;
  text-decoration: none;
  display: grid;
  gap: 3px;
  border-radius: 9px;
  background: #fff;
}

.network-links a span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.network-links a strong,
.network-current-link {
  color: var(--blue);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.network-current-link {
  display: block;
  padding: 13px;
  border: 1px solid rgba(0, 173, 181, .35);
  border-radius: 9px;
  background: rgba(0, 173, 181, .06);
  text-decoration: none;
}

.network-section {
  display: grid;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.network-section h3 { margin: 0; }

.network-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.network-monitor-controls {
  display: flex;
  align-items: end;
  gap: 8px;
}

.network-monitor-controls label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.network-monitor-controls select {
  display: block;
  min-height: 36px;
  margin-top: 3px;
}

.network-status-banner {
  padding: 14px 16px;
  border-radius: 10px;
  font-weight: 900;
  border: 1px solid transparent;
}

.network-status-banner.checking { background: #eef3f7; color: var(--muted); }
.network-status-banner.healthy { background: #dff4e8; color: #17643a; border-color: #b7e2c8; }
.network-status-banner.warning { background: #fff1c8; color: #7a5a00; border-color: #ecd481; }
.network-status-banner.critical { background: #f8dcdc; color: #8f2229; border-color: #e4aeb1; }

.network-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.network-stat-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.network-stat-card small,
.network-stat-card span { display: block; color: var(--muted); }
.network-stat-card small { font-size: 11px; font-weight: 800; }
.network-stat-card strong { display: block; margin: 5px 0; color: var(--ink); font-size: 20px; overflow-wrap: anywhere; }
.network-stat-card span { font-size: 10px; line-height: 1.35; }

.network-warnings { display: grid; gap: 7px; }
.network-warnings p { margin: 0; padding: 10px 12px; border-radius: 8px; font-weight: 750; }
.network-warnings p.healthy { background: #eaf7ef; color: #17643a; }
.network-warnings p.warning { background: #fff1c8; color: #7a5a00; }
.network-warnings p.critical { background: #f8dcdc; color: #8f2229; }

.network-diagnosis {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.network-diagnosis strong { display: block; font-size: 18px; }
.network-diagnosis p { margin: 5px 0 0; color: var(--muted); line-height: 1.45; }
.network-diagnosis.healthy { border-color: #b7e2c8; background: #eff9f3; }
.network-diagnosis.healthy strong { color: #17643a; }
.network-diagnosis.warning { border-color: #ecd481; background: #fff8e4; }
.network-diagnosis.warning strong { color: #7a5a00; }
.network-diagnosis.critical { border-color: #e4aeb1; background: #fcedee; }
.network-diagnosis.critical strong { color: #8f2229; }

.network-limits { display: grid; gap: 9px; }
.network-no-user-limit { margin: 0; color: var(--ink); }
.network-limit-row {
  display: grid;
  grid-template-columns: 125px minmax(100px, 1fr) 105px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.network-limit-row progress { width: 100%; height: 13px; accent-color: var(--accent); }
.network-limit-row strong { text-align: right; }

.network-endpoints-wrap { display: grid; gap: 8px; margin-top: 5px; }
.network-endpoints-wrap h4 { margin: 0; }
.network-endpoints { overflow-x: auto; }
.network-endpoint-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(4, 82px);
  min-width: 560px;
  border-bottom: 1px solid var(--line);
}
.network-endpoint-row > * { padding: 8px; }
.network-endpoint-row code { background: transparent; border: 0; overflow-wrap: anywhere; }
.network-endpoint-head { background: #393e46; color: #fff; font-weight: 800; }

@media (max-width: 720px) {
  .network-body { padding: 13px; }
  .network-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .network-section-title { align-items: stretch; flex-direction: column; }
  .network-monitor-controls { align-items: stretch; flex-direction: column; }
  .network-limit-row { grid-template-columns: 95px minmax(70px, 1fr); }
  .network-limit-row strong { grid-column: 2; text-align: left; }
}

.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;
}

.ios-export-ready {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 300;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 42px;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(0, 173, 181, .35);
  border-radius: 14px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 55px rgba(22, 28, 45, .24);
  backdrop-filter: blur(16px);
}

.ios-export-ready strong,
.ios-export-ready small { display: block; }
.ios-export-ready small { color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-export-ready .primary { min-height: 44px; }
.ios-export-ready .icon-button { width: 42px; height: 42px; }

.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;
}

/* Keep the network dashboard inside the viewport and scroll its content. */
.manage-dialog.network-dialog {
  width: min(920px, calc(100vw - 28px));
  height: min(900px, calc(100dvh - 28px));
  max-height: calc(100dvh - 28px);
}

.network-dialog > form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.network-dialog > form > header {
  flex: 0 0 auto;
}

.network-dialog .network-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

@media (max-width: 720px) {
  .manage-dialog.network-dialog {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
  }
}

.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 {
    width: calc(100% - 36px);
    padding: 24px 0;
  }

  .detail-media {
    min-height: 280px;
    padding: 28px 18px 20px;
  }

  .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,
  .cost-popup-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(4, minmax(112px, 1fr));
    overflow-x: auto;
    justify-content: start;
    margin: 10px auto 0;
    scrollbar-width: thin;
  }

  .anchor-tabs::before { display: none; }

  .anchor-tabs a { font-size: 12px; white-space: nowrap; }
  .anchor-tabs a.active {
    background: var(--ink);
    box-shadow: inset 0 -4px 0 var(--accent);
  }
  .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: "Stock Level: ";
    color: var(--muted);
    font-weight: 900;
  }

  .product-list-row > span:nth-child(6)::before {
    content: "Prices: ";
    color: var(--muted);
    font-weight: 900;
  }

  .product-list-row > span:nth-child(7)::before {
    content: "Brand: ";
    color: var(--muted);
    font-weight: 900;
  }

  .product-list-row > span:nth-child(8)::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; }

  .app-back-button:not([hidden]) { display: inline-flex; }

  .app-back-button + .brand-lockup { min-width: 0; }

  .app-back-button:not([hidden]) + .brand-lockup small { display: none; }

  .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-nav-group { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
  .mobile-nav-group summary { cursor: pointer; padding: 12px; font-weight: 900; background: #f4f8f8; }
  .mobile-nav-group[open] { padding-bottom: 7px; }
  .mobile-nav-group a { margin: 0 7px; }

  .mobile-menu-heading { grid-column:1 / -1; padding:4px 4px 2px; color:var(--muted); font-size:11px; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }

  .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%; }

  #productsPage.layout { grid-template-columns:minmax(0,1fr) !important; width:100%; }
  #productsPage .filters { display:block !important; width:100%; max-width:none; padding:12px; border:0; }
  #productsPage .filters-title,
  #productsPage .search-box,
  #productsPage .filter-group { margin-left:0; margin-right:0; }
  #productsPage .content { width:100%; max-width:100%; padding:8px 12px 24px; }
  #productsPage .product-grid { grid-template-columns:minmax(0,1fr); }

  .stock-analysis-page { padding:10px !important; }
  .stock-analysis-page .page-hero { padding:15px; }
  .analysis-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .classification-compare { grid-template-columns:1fr; }
  .analysis-bulkbar { align-items:stretch; flex-direction:column; }
  .analysis-bulkbar span { margin:0; }
  .analysis-bulkbar button { width:100%; min-height:44px; }
  .analysis-table { min-width:0; width:100%; border-collapse:separate; }
  .analysis-table thead { display:none; }
  .analysis-table tbody { display:grid; gap:12px; }
  .analysis-table tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:12px; border:1px solid #dce5e6; border-top:4px solid var(--accent); border-radius:10px; background:#fff; box-shadow:0 8px 22px rgba(23,47,50,.08); }
  .analysis-table td { display:flex; align-items:center; justify-content:space-between; gap:10px; min-width:0; padding:8px 6px; border:0; border-bottom:1px solid #edf1f1; text-align:left; }
  .analysis-table td::before { content:attr(data-label); color:var(--muted); font-size:11px; font-weight:900; text-transform:uppercase; }
  .analysis-table td[data-label="Product"],
  .analysis-table td[data-label="Reason"],
  .analysis-table td[data-label="Action"] { grid-column:1 / -1; }
  .analysis-table td[data-label="Product"] { align-items:flex-start; flex-direction:column; }
  .analysis-table td[data-label="Reason"] { max-width:none; align-items:flex-start; flex-direction:column; }
  .analysis-table td[data-label="Action"] button { width:100%; min-height:42px; }
  .analysis-table td[data-label="30D"],
  .analysis-table td[data-label="90D"],
  .analysis-table td[data-label="Monthly Velocity"],
  .analysis-table td[data-label="Coverage"],
  .analysis-table td[data-label="Last Sale"] { display:none; }
}

@keyframes mobilePageIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 760px) {
  body.mobile-filters-open { overflow: hidden; }
  #productsPage .filters {
    position: fixed;
    top: calc(68px + env(safe-area-inset-top));
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 95;
    display: none !important;
    padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f7f9f9;
    border-top: 4px solid var(--accent);
  }

  body.mobile-filters-open #productsPage .filters { display: block !important; }
  body.mobile-filters-open #productsPage .content { pointer-events: none; }

  #productsPage .filters-title {
    position: sticky;
    top: -14px;
    z-index: 4;
    margin: -14px -14px 12px;
    padding: 13px 14px;
    border-bottom: 1px solid #dce4e5;
    background: rgba(255,255,255,.97);
    box-shadow: 0 8px 18px rgba(20,40,44,.07);
  }

  .filter-title-actions { display: flex; align-items: center; gap: 7px; }
  .mobile-filter-close {
    display: inline-flex;
    min-width: 64px;
    min-height: 42px;
    padding: 0 12px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d7e0e2;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
  }

  #productsPage .filters .search-box { display: none; }
  #productsPage .filter-group { margin: 0 0 10px; box-shadow: none; border: 1px solid #dde6e7; }
  #productsPage .filter-group h3 { font-size: 16px; }

  .mobile-apply-filters {
    position: static;
    width: 100%;
    margin-top: 14px;
    display: none;
    min-height: 52px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 136, 142, .2);
  }
  body.mobile-filters-open .mobile-apply-filters { display: block; }

  #productsPage .content { padding: 10px 12px 24px; }
  #productsPage .mobile-quick-search {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    gap: 6px;
    margin: 0 0 10px;
    padding: 9px 10px 10px;
    border: 1px solid #cfdcde;
    border-top: 3px solid var(--accent);
    border-radius: 10px;
    background: rgba(255,255,255,.97);
    box-shadow: 0 8px 22px rgba(21,43,47,.1);
  }
  #productsPage .mobile-quick-search span { color: var(--accent-dark); font-size: 12px; font-weight: 900; }
  #productsPage .mobile-quick-search input {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid #cbd7d9;
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
  }
  body.mobile-filters-open #productsPage .mobile-quick-search { display: none; }
  #productsPage .toolbar {
    padding: 12px;
    gap: 10px;
    border: 1px solid #dce4e5;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 8px 22px rgba(21, 43, 47, .08);
  }
  #productsPage .toolbar .muted { color: var(--muted); }
  #productsPage .toolbar > div:first-child { align-items: center; }

  .mobile-filter-toggle {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: rgba(0, 173, 181, .08);
    color: var(--accent-dark);
    font-weight: 900;
  }
  #productsPage .view-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px 46px 46px;
    gap: 7px;
  }
  #productsPage .page-size-control {
    min-width: 0;
    min-height: 44px;
    gap: 5px;
    font-size: 11px;
  }
  #productsPage .page-size-control select { min-width: 0; width: 100%; padding: 0 7px; font-size: 13px; }
  #productsPage .view-tools .icon-button { width: 46px; min-width: 46px; min-height: 46px; }

  #productsPage .grouped-products { margin-top: 14px; gap: 16px; }
  #productsPage .group-title { margin-bottom: 9px; padding-left: 9px; font-size: 16px; }
  #productsPage .group-title span { font-size: 12px; }

  #productsPage .product-card {
    min-height: 0;
    padding: 12px;
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    column-gap: 12px;
    align-items: start;
    border-radius: 10px;
  }
  #productsPage .product-card > img {
    grid-column: 1;
    grid-row: 1 / 5;
    width: 108px;
    height: 118px;
    margin: 15px 0 0;
  }
  #productsPage .product-card h3 {
    grid-column: 2;
    margin: 5px 0 3px;
    min-height: 0;
    font-size: 16px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  #productsPage .product-card > p {
    grid-column: 2;
    margin: 0 0 7px;
    font-size: 13px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  #productsPage .product-card .stock-line {
    grid-column: 2;
    display: grid;
    gap: 4px;
    margin: 0;
    font-size: 12px;
  }
  #productsPage .product-card .price-row {
    grid-column: 1 / -1;
    margin-top: 12px;
  }
  #productsPage .price-chip { padding: 7px 5px; }
  #productsPage .price-chip small { font-size: 9px; }
  #productsPage .price-chip strong { font-size: 12px; overflow-wrap: anywhere; }
  #productsPage .card-actions { grid-column: 1 / -1; grid-template-columns: repeat(5, 44px); gap: 7px; justify-content: start; margin-top: 9px; }
  #productsPage .card-actions button { min-width: 0; min-height: 44px; padding: 7px 5px; }
  #productsPage .card-actions .compact-action { width: 44px; font-size: 21px; }
  .detail-stock-analysis { padding: 13px; }
  .detail-analysis-heading { display: grid; gap: 4px; }
  .detail-analysis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.not-admin .admin-only { display: none !important; }

.health-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; margin-top:16px; }
.health-card { padding:16px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.health-card small { display:block; color:var(--muted); margin-bottom:6px; }
.health-card strong { color:var(--ink); font-size:18px; }
.health-card.ok strong { color:var(--accent); }
.health-card.warn strong { color:#c47b00; }

.stock-analysis-page { max-width: 1800px; }
.stock-analysis-hero { display:flex; align-items:end; justify-content:space-between; gap:24px; }
.stock-analysis-hero .eyebrow, .analysis-dialog .eyebrow { color:var(--accent-dark); font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
.analysis-run-controls { display:flex; align-items:end; gap:12px; min-width:360px; }
.analysis-run-controls label { flex:1; font-weight:800; }
.analysis-run-controls select, .analysis-toolbar input, .analysis-toolbar select { width:100%; padding:11px 12px; border:1px solid #cad6d8; border-radius:9px; background:#fff; }
.analysis-empty, .analysis-progress { margin-top:20px; padding:34px; text-align:center; border:1px dashed #b9c9cb; border-radius:16px; background:#f8fbfb; color:var(--muted); }
.progress-heading { display:flex; justify-content:space-between; color:var(--ink); }
.progress-track { height:12px; margin:14px 0; overflow:hidden; border-radius:999px; background:#dfe9ea; }
.progress-track i { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--accent),var(--amber)); transition:width .3s ease; }
.analysis-run-banner { margin:20px 0 12px; padding:14px 18px; display:flex; justify-content:space-between; gap:16px; background:var(--ink); color:#fff; border-radius:12px; }
.analysis-kpis { display:grid; grid-template-columns:repeat(8,minmax(120px,1fr)); gap:10px; }
.analysis-kpis article { padding:14px; border:1px solid #d9e3e4; border-radius:12px; background:#fff; box-shadow:0 5px 16px rgba(23,47,50,.06); }
.analysis-kpis span { display:block; min-height:36px; color:var(--muted); font-size:12px; font-weight:800; }
.analysis-kpis strong { font-size:25px; color:var(--ink); }
.classification-compare { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:12px 0; }
.classification-compare>div { padding:14px; border-radius:12px; background:#f3f7f7; display:flex; align-items:center; gap:9px; }
.classification-compare strong { margin-inline-end:auto; }
.analysis-toolbar { display:grid; grid-template-columns:2fr repeat(4,1fr); gap:10px; margin:16px 0 10px; }
.analysis-bulkbar { display:flex; align-items:center; gap:10px; padding:10px 0; }
.analysis-bulkbar span { margin-inline-end:auto; font-weight:800; }
.danger-outline { padding:10px 14px; border:1px solid #b73b3b; border-radius:8px; background:#fff; color:#a42929; }
.analysis-table { min-width:1550px; }
.analysis-table th { position:sticky; top:0; z-index:2; white-space:nowrap; }
.analysis-table td { vertical-align:middle; }
.analysis-table small { display:block; margin-top:5px; color:var(--muted); }
.classification-change { background:#fffdf6; }
.level-change { display:flex; align-items:center; justify-content:center; gap:5px; direction:ltr; }
.level-badge { display:inline-grid; place-items:center; width:28px; height:28px; border-radius:8px; color:#fff; font-weight:900; }
.level-A { background:#258a52; }.level-B { background:#2878b5;}.level-C { background:#d77b16;}.level-D { background:#bd3f43;}
.stock-status { display:inline-block; padding:5px 8px; border-radius:999px; background:#e7eff0; font-size:11px; font-weight:900; white-space:nowrap; }
.status-out-of-stock,.status-dead-stock { background:#f8dcdc; color:#8f2229; }.status-critical { background:#ffe5cc; color:#9b4d00; }.status-low { background:#fff1c8; color:#7a5a00; }.status-healthy { background:#d9f2e3; color:#17643a; }.status-overstock { background:#dce8f7; color:#225c94; }
.reason-cell { min-width:240px; max-width:320px; line-height:1.45; }
.link-button { border:0; background:none; padding:0; color:var(--accent-dark); font-weight:900; cursor:pointer; text-align:start; }
.analysis-dialog { width:min(780px,92vw); border:0; border-radius:18px; padding:28px; }
.analysis-dialog::backdrop { background:rgba(10,24,26,.6); }
.analysis-dialog>.icon-button { position:absolute; top:14px; inset-inline-end:14px; }
.detail-levels { display:flex; align-items:center; gap:10px; padding:14px 0; direction:ltr; }
.detail-levels>strong { margin-left:auto; font-size:24px; }
.analysis-detail-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:10px 0 20px; }
.analysis-detail-grid>div { padding:12px; border-radius:10px; background:#f2f6f6; }
.analysis-detail-grid span { display:block; color:var(--muted); font-size:12px; }.analysis-detail-grid strong { display:block; margin-top:5px; }

@media (max-width:1100px) { .analysis-kpis { grid-template-columns:repeat(4,1fr); }.analysis-toolbar { grid-template-columns:1fr 1fr; }.stock-analysis-hero { align-items:stretch; flex-direction:column; }.analysis-run-controls { min-width:0; } }
@media (max-width:700px) { .analysis-kpis { grid-template-columns:repeat(2,1fr); }.classification-compare,.analysis-detail-grid { grid-template-columns:1fr 1fr; }.analysis-toolbar { grid-template-columns:1fr; }.analysis-run-controls { flex-direction:column; align-items:stretch; }.analysis-run-banner { flex-direction:column; } }

@media (max-width: 760px) {
  .download-product-image {
    position: static;
    transform: none;
    width: min(100%, 260px);
    min-height: 44px;
    border-radius: 8px;
    flex-direction: row;
    padding: 9px 16px;
  }

  .download-product-image:hover {
    transform: none;
  }

  .download-product-image span {
    font-size: 22px;
  }

  .download-product-image strong {
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 13px;
  }
}

.pricebook-page { padding: 24px; max-width: 1500px; margin: auto; }
#pbList > h2 { display:flex; align-items:center; gap:12px; margin:28px 0 14px; color:#17334d; font-size:19px; }
#pbList > h2::after { content:""; height:1px; background:#e1e8ef; flex:1; }
#pbList .pb-archive-card { display:grid; grid-template-columns:56px minmax(0,1fr) auto; align-items:center; gap:18px; padding:22px; margin:12px 0; border:1px solid #dce5ee; border-radius:16px; background:#fff; box-shadow:0 3px 12px #17334d05; transition:border-color .18s,box-shadow .18s; }
#pbList .pb-archive-card:hover { border-color:#a9cbd0; box-shadow:0 6px 20px #17334d0b; }
.pb-file-icon { display:grid; place-items:center; width:56px; height:64px; border-radius:12px; font-size:12px; font-weight:800; letter-spacing:.4px; }
.pb-file-icon.excel { background:#eaf6ef; color:#217346; }
.pb-file-icon.pdf { background:#fff0ef; color:#b63732; }
.pb-card-info { min-width:0; }
.pb-card-heading { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.pb-card-heading h3 { margin:0; font-size:16px; line-height:1.6; color:#17334d; overflow-wrap:anywhere; }
.pb-quarter { border-radius:6px; padding:4px 8px; background:#edf3f8; color:#50677e; font-size:11px; font-weight:700; white-space:nowrap; }
#pbList .pb-file-name { margin:7px 0 10px; font-size:12px; color:#64748b; overflow-wrap:anywhere; text-align:start; }
.pb-file-meta { display:flex; align-items:center; flex-wrap:wrap; gap:8px 16px; font-size:12px; color:#64748b; font-variant-numeric:tabular-nums; }
#pbList .pb-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
#pbList .pb-actions button,#pbList .pb-actions a { display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:9px 14px; box-sizing:border-box; border:1px solid #dce5ee; border-radius:9px; background:#fff; color:#34495e; font:600 12px/1.4 inherit; font-family:inherit; font-size:12px; text-decoration:none; cursor:pointer; white-space:nowrap; transition:background .15s,border-color .15s; }
#pbList .pb-actions button:hover,#pbList .pb-actions a:hover { background:#f0f5f9; border-color:#aabccc; }
#pbList .pb-actions .pb-view-action { background:#00858c; border-color:#00858c; color:#fff; font-weight:700; }
#pbList .pb-actions .pb-view-action:hover { background:#006e75; }
#pbList .pb-actions .pb-delete-action { color:#b42318; border-color:#f1d6d3; margin-inline-start:8px; }
#pbList .pb-actions .pb-delete-action:hover { background:#fff0ee; border-color:#df9d96; }
#pbList .pb-actions :focus-visible { outline:3px solid #00adb580; outline-offset:3px; }
@media(max-width:1100px) { #pbList .pb-archive-card { grid-template-columns:48px minmax(0,1fr); gap:14px; } .pb-file-icon { width:48px; height:56px; } #pbList .pb-actions { grid-column:1/-1; padding-top:14px; border-top:1px solid #edf1f5; } }
@media(max-width:560px) { #pbList .pb-archive-card { padding:16px; } #pbList .pb-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); } #pbList .pb-actions .pb-delete-action { margin-inline-start:0; } #pbList .pb-actions button,#pbList .pb-actions a { min-height:44px; } }
.pb-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px; margin:16px 0; }
.pb-archive-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap; }
#pbArchiveDialog { width:min(640px,calc(100vw - 24px)); max-height:calc(100dvh - 32px); padding:0; border:1px solid #dce5ef; border-radius:18px; color:#17334d; background:#fff; box-shadow:0 24px 80px #102c4c40; overflow:auto; }
#pbArchiveDialog::backdrop { background:#10203088; }
#pbArchiveDialog #pricebookForm { margin:0; padding:24px; border:0; box-shadow:none; }
.pb-dialog-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.pb-dialog-heading h2 { margin:0 0 8px; }
.pb-dialog-heading p { margin:0; color:#64748b; font-size:13px; }
#pbArchiveDialog button { min-height:42px; border-radius:9px; padding:8px 18px; cursor:pointer; }
.pb-dialog-heading button { background:#f1f5f9; border:0; font-size:24px; }
#pbArchiveDialog label { display:flex; flex-direction:column; gap:8px; min-width:0; }
#pbArchiveDialog input,#pbArchiveDialog select { width:100%; min-width:0; min-height:44px; border:1px solid #cbd5e1; border-radius:8px; padding:9px 12px; box-sizing:border-box; background:#fff; }
#pbArchiveDialog small { color:#64748b; }
#pbArchiveDialog #pbDropZone { grid-column:1/-1; border:2px dashed #a9cbd0; border-radius:12px; padding:20px; background:#f5fafb; text-align:center; cursor:pointer; }
#pbDropZone.drag-over { outline:3px solid #00adb5; }
#pbFileInfo { overflow-wrap:anywhere; }
#pbArchiveDialog #pbFileError { color:#b42318; }
.pb-dialog-actions { display:flex; gap:10px; justify-content:flex-start; border-top:1px solid #e2e8f0; padding-top:18px; }
.pb-dialog-actions button:not(.primary) { background:#fff; border:1px solid #cbd5e1; color:#334155; }
#pbUploadProgress { width:100%; margin-bottom:16px; accent-color:#00adb5; }
#pbArchiveDialog button:disabled { opacity:.6; cursor:wait; }
@media(max-width:560px) { #pbArchiveDialog #pricebookForm { padding:18px; } #pbArchiveDialog .pb-fields { grid-template-columns:1fr; } .pb-dialog-actions button { flex:1; } }
.pricebook-page label { display:flex; flex-direction:column; gap:8px; }
.pb-card { display:flex; justify-content:space-between; align-items:center; gap:18px; padding:20px; margin:12px 0; border:1px solid #d9dee5; border-radius:12px; background:white; }
.pb-card p { white-space:pre-wrap; overflow-wrap:anywhere; }
.pb-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.pb-grid { overflow:auto; max-height:65vh; margin:16px 0; border:1px solid #d9dee5; }
.pb-grid table { border-collapse:collapse; min-width:100%; font-size:13px; }
.pb-grid td,.pb-grid th { border:1px solid #dde2e8; padding:8px 12px; white-space:pre-wrap; min-width:90px; max-width:400px; overflow-wrap:anywhere; }
.pb-grid thead th { position:sticky; top:0; background:#e8edf3; color:#253345; }
.pb-grid tbody th { background:#f2f5f8; }
.pb-grid tr:nth-child(even) td { background:#f7f9fb; }
#pbViewer { margin-top:24px; scroll-margin-top:100px; }
@media(max-width:700px) { .pricebook-page { padding:14px; } .pb-card { flex-direction:column; align-items:stretch; } }

/* Pricebook document viewer */
[hidden] { display:none !important; }
.pb-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; border-bottom:1px solid #dde2e8; padding-bottom:14px; }
.pb-toolbar label { margin-inline-start:auto; flex-direction:row; align-items:center; }
#pbPdfFrame { width:100%; height:72vh; border:1px solid #d9dee5; border-radius:10px; background:#e5e7eb; }
#pbViewer.pb-expanded { position:fixed; inset:12px; z-index:2000; margin:0; background:white; overflow:auto; padding:24px; box-shadow:0 0 0 30px #0009; }
.pb-grid table { font-size:var(--pb-font,13px); }
#pbViewer { min-width: 0; border-radius: 16px; border: 1px solid #dce5ef; box-shadow: 0 12px 32px #17334d0a; padding: 22px; }
#pbViewer .pb-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding-bottom:14px; border-bottom:1px solid #e3eaf1; }
#pbViewer button { border:1px solid #ccd9e5; border-radius:8px; background:#f5f8fc; color:#17334d; padding:9px 16px; cursor:pointer; font:inherit; }
#pbViewer button:disabled { opacity:.45; cursor:default; }
#pbViewer select, #pbViewer input { min-height:42px; border:1px solid #ccd9e5; border-radius:8px; padding:8px 12px; background:#fff; }
#pbTitle { color:#17334d; line-height:1.6; }
#pbRows { color:#526579; font-variant-numeric:tabular-nums; }
#pbGrid { direction:ltr; border-radius:10px; border:1px solid #d9e3ed; max-height:65vh; scrollbar-width:auto; }
#pbGrid table { width:max-content; min-width:100%; table-layout:auto; border-collapse:separate; border-spacing:0; }
#pbGrid td, #pbGrid th { min-width:150px; max-width:none; padding:12px 16px; line-height:1.55; border:0; border-right:1px solid #e4eaf0; border-bottom:1px solid #e4eaf0; overflow-wrap:normal; word-break:normal; }
#pbGrid td { white-space:pre; }
#pbGrid .pb-number { text-align:right; font-variant-numeric:tabular-nums; color:#174b72; }
#pbGrid thead th { background:#17334d; color:#fff; z-index:3; height:36px; }
#pbGrid th:first-child { min-width:54px; width:54px; text-align:center; }
#pbGrid thead th:first-child { left:0; z-index:4; }
#pbGrid tbody th { color:#61748a; background:#edf2f7; }
#pbGrid tbody tr:hover td { background:#eaf5f8; }
@media(max-width:760px) { #pbViewer { padding:12px; } #pbGrid td,#pbGrid th { padding:10px 12px; } }
.pb-grid tbody tr:hover td { background:#e9f3ff; }
.pb-grid tbody th { position:sticky; left:0; z-index:1; }
.pb-card { border-inline-start:4px solid #517899; box-shadow:0 3px 12px #23334508; }
.pb-actions button, .pb-actions a { padding:9px 14px; border-radius:8px; }
@media(max-width:700px) { #pbViewer.pb-expanded { inset:4px; padding:12px; } #pbPdfFrame { height:65vh; } }

/* Commercial workflows: quotation, purchase order and packing list */
.order-dialog { width:min(1050px,calc(100vw - 32px)); max-height:calc(100vh - 28px); }
.order-dialog > form { max-height:calc(100vh - 28px); display:flex; flex-direction:column; }
.order-dialog .order-body { overflow-y:auto; min-height:0; }
.cart-workflow-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:8px; }
.cart-workflow-card { display:flex; flex-direction:column; gap:12px; min-width:0; padding:16px; border:1px solid var(--line); border-radius:12px; background:linear-gradient(145deg,#fff,#f7fafb); }
.cart-workflow-card h3,.quotation-archive h3 { margin:0; color:#17324d; }
.cart-workflow-card label,.packing-list-page label { display:flex; flex-direction:column; gap:6px; min-width:0; font-size:12px; font-weight:800; color:#526575; }
.cart-field-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(125px,1fr)); gap:10px; }
.cart-field-row input,.cart-field-row select,.cart-workflow-card>label input { width:100%; min-width:0; }
.quotation-card { border-top:4px solid #08a6a6; }
.order-export-card { border-top:4px solid #f2b544; }
.quote-items-pricing { display:grid; gap:6px; overflow-x:auto; border:1px solid var(--line); border-radius:10px; background:#fff; }
.quote-price-row { display:grid; grid-template-columns:minmax(150px,1.4fr) 64px minmax(115px,.8fr) minmax(115px,.8fr); align-items:center; gap:8px; min-width:520px; padding:8px 10px; border-bottom:1px solid #e6edef; }
.quote-price-row:last-child { border-bottom:0; }
.quote-price-head { background:#edf6f7; color:#49606f; font-size:11px; font-weight:900; }
.quote-price-row input { width:100%; min-width:0; padding:8px; text-align:end; font-weight:800; border-color:#a9ced2; background:#f2fbfb; }
.quote-price-row b { color:#078b8c; text-align:end; white-space:nowrap; }
.quote-pricing-summary { display:flex; flex-direction:column; gap:6px; padding:11px 12px; border-radius:10px; background:#17324d; color:#fff; }
.quote-pricing-summary span,.quote-pricing-summary strong { display:flex; justify-content:space-between; gap:12px; }
.quote-pricing-summary strong { padding-top:7px; border-top:1px solid #ffffff3b; font-size:15px; }
.quotation-archive { margin-top:4px; padding-top:14px; border-top:1px solid var(--line); }
.quotations-page { max-width:1200px; margin-inline:auto; }
.quotation-search-panel { display:grid; grid-template-columns:minmax(240px,1fr) auto; align-items:end; gap:12px; }
.quotation-search-panel label { display:flex; flex-direction:column; gap:6px; font-weight:800; color:#526575; }
.quotation-pagination { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:7px; margin-top:18px; }
.quotation-pagination button { min-width:42px; }
.quotation-pagination button.active { border-color:#078b8c; background:#078b8c; color:#fff; }
.pagination-gap { padding:0 4px; color:var(--muted); }
.commercial-archive-list { display:grid; gap:9px; margin-top:10px; }
.commercial-archive-item { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 14px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.commercial-archive-item>div { display:flex; flex-direction:column; gap:4px; min-width:0; }
.commercial-archive-item>div:last-child { align-items:flex-end; flex-shrink:0; }
.commercial-archive-item span,.commercial-archive-item small { overflow-wrap:anywhere; }
.commercial-archive-item small { color:var(--muted); }
.commercial-archive-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:7px; }
.commercial-delete-button { min-height:36px; padding:7px 12px; }
.button-link { display:inline-flex; align-items:center; justify-content:center; text-decoration:none; padding:8px 12px; border-radius:8px; }
.packing-list-page { max-width:1600px; margin-inline:auto; }
.packing-upload-panel,.packing-workspace,.packing-archive-panel { margin-bottom:18px; }
.packing-primary-fields { display:grid; grid-template-columns:minmax(260px,1.5fr) repeat(2,minmax(190px,1fr)) auto; align-items:end; gap:14px; }
.packing-workspace { display:grid; gap:18px; }
.section-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.section-title-row h2 { margin:0 0 5px; }
.section-title-row p { margin:0; }
.packing-invoice-meta { display:grid; grid-template-columns:repeat(auto-fit,minmax(245px,1fr)); gap:12px; margin-top:14px; }
.packing-invoice-card { display:grid; gap:9px; min-width:0; padding:13px; border:1px solid var(--line); border-radius:10px; background:#f8fbfc; }
.packing-invoice-card>strong { overflow-wrap:anywhere; color:#17324d; }
.packing-table-wrap { max-width:100%; margin-top:14px; overflow:auto; border:1px solid var(--line); border-radius:10px; }
.packing-preview-table { width:100%; min-width:1500px; border-collapse:collapse; direction:rtl; font-size:12px; }
.packing-preview-table th { position:sticky; top:0; z-index:1; padding:11px 8px; background:#17324d; color:#fff; white-space:nowrap; }
.packing-preview-table td { padding:8px; border-bottom:1px solid var(--line); background:#fff; text-align:center; vertical-align:middle; }
.packing-preview-table tr:nth-child(even) td { background:#f6fafb; }
.packing-preview-table tr.packing-unmatched td,.packing-preview-table tr.packing-ambiguous td { background:#fff7f4; color:#8c5651; }
.packing-preview-table input { width:130px; min-height:36px; padding:6px 8px; border:1px solid #b9d6db; border-radius:7px; background:#effafb; }
.packing-preview-table input[type="checkbox"] { width:18px; min-height:18px; padding:0; accent-color:#08a6a6; }
.packing-preview-table td:nth-child(4) { min-width:230px; text-align:start; }
.packing-carton-builder { border-top:4px solid #08a6a6; }
.packing-carton-actions { display:flex; justify-content:flex-start; flex-wrap:wrap; gap:8px; }
.packing-carton-merge-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(380px,1fr)); gap:10px; max-height:480px; margin-top:16px; padding:4px; overflow:auto; }
.packing-merge-card { display:grid!important; grid-template-columns:22px 92px minmax(0,1fr); grid-template-rows:auto auto; align-items:center; gap:6px 10px; min-height:88px; padding:12px 13px; border:1px solid #cbdde1; border-radius:11px; background:#fff; cursor:pointer; transition:border-color .15s,box-shadow .15s,background .15s; }
.packing-merge-card:hover { border-color:#73bfc1; }
.packing-merge-card.selected { border-color:#078f91; background:#eefafa; box-shadow:0 0 0 3px #08a6a61c; }
.packing-merge-card>input { grid-row:1/3; width:18px; min-height:18px; margin:0; accent-color:#078f91; }
.packing-merge-number { grid-column:2; grid-row:1; color:#17324d; font-size:15px; white-space:nowrap; }
.packing-merge-products { grid-column:3; grid-row:1/3; display:flex; flex-direction:column; gap:6px; min-width:0; padding-inline:12px; border-inline-start:1px solid #dce8eb; }
.packing-merge-products>span { display:flex; align-items:baseline; justify-content:space-between; gap:8px; min-width:0; }
.packing-merge-products b { color:#314b5f; font-size:13px; line-height:1.35; overflow-wrap:anywhere; }
.packing-merge-products small { flex-shrink:0; color:#718391; font-size:11px; white-space:nowrap; }
.packing-merge-products em { color:#078f91; font-size:10px; font-style:normal; font-weight:900; }
.packing-merge-total { grid-column:2; grid-row:2; justify-self:start; padding:5px 8px; border-radius:7px; background:#e8f6f6; color:#08777b; font-size:11px; white-space:nowrap; }
.packing-carton-details { margin-top:14px; border-top:1px solid var(--line); }
.packing-carton-details>summary { padding:13px 2px 6px; color:#365367; font-size:13px; font-weight:900; cursor:pointer; }
.packing-carton-details>.hint { margin:3px 0 0; }
.packing-carton-table { min-width:1100px; }
.packing-carton-table td:nth-child(3) { min-width:220px; text-align:start; }
.packing-carton-table input[data-carton-field="carton_number"] { width:90px; text-align:center; font-weight:900; }
.packing-carton-table input[data-carton-field="quantity"] { width:110px; }
.packing-carton-table input[data-carton-field="package_dimensions"] { width:155px; }
.packing-status { display:inline-block; padding:5px 8px; border-radius:999px; font-size:11px; font-weight:900; white-space:nowrap; }
.packing-status.matched { background:#dff5e8; color:#17663c; }
.packing-status.unmatched,.packing-status.ambiguous { background:#ffe1df; color:#9a302d; }
.packing-summary { display:flex; flex-wrap:wrap; gap:8px; direction:rtl; }
.packing-summary span { display:inline-flex; gap:5px; padding:7px 10px; border-radius:8px; background:#edf5f7; color:#526575; white-space:nowrap; }
.packing-summary .warning { background:#fff0d8; color:#8a5800; }
.packing-summary .ready { background:#dff5e8; color:#17663c; }
.packing-export-row { display:flex; align-items:flex-end; justify-content:flex-start; flex-wrap:wrap; gap:12px; margin-top:14px; }
.packing-export-row select { min-width:160px; }
.packing-export-row .packing-label-download { flex-direction:row; align-items:center; gap:8px; min-height:44px; padding:0 12px; border:1px solid var(--line); border-radius:8px; background:#f8fbfc; }
.packing-label-download input { width:18px; min-height:18px; margin:0; accent-color:#08a6a6; }

@media(max-width:900px) {
  .cart-workflow-grid { grid-template-columns:1fr; }
  .packing-primary-fields { grid-template-columns:1fr 1fr; }
}
@media(max-width:620px) {
  .order-body { padding:12px; }
  .order-row { grid-template-columns:1fr 74px 40px; gap:7px; }
  .order-row span:first-child { grid-column:1/-1; }
  .order-head { display:none; }
  .packing-primary-fields { grid-template-columns:1fr; }
  .quotation-search-panel { grid-template-columns:1fr; }
  .section-title-row,.commercial-archive-item { flex-direction:column; align-items:stretch; }
  .commercial-archive-item>div:last-child { align-items:stretch; }
  .packing-carton-actions,.packing-export-row { flex-direction:column; align-items:stretch; }
  .packing-carton-merge-list { grid-template-columns:1fr; max-height:520px; }
  .packing-merge-card { grid-template-columns:22px 84px minmax(0,1fr); }
}

/* Compact navigation and shared currency controls. */
.topbar { gap: 12px; padding-inline: 16px; background: #fff; backdrop-filter: none; }
.topbar .brand-lockup { min-width: 0; flex-shrink: 0; }
.topbar .brand-lockup small { display: none; }
.topbar .page-tabs { gap: 4px; flex: 1; }
.topbar .top-actions { gap: 6px; }
.currency-select, #exportCurrencySelect { min-height: 40px; border: 1px solid #cbd5df; border-radius: 10px; background: #f5f8fb; color: #17334d; padding: 8px 12px; font-weight: 700; }
@media (min-width: 761px) and (max-width: 1350px) {
  .topbar { height: auto; min-height: 72px; flex-wrap: wrap; padding-block: 8px; }
  .topbar .page-tabs { order: 3; flex-basis: 100%; justify-content: center; }
  .topbar .top-actions { margin-left: auto; }
}
@media (max-width: 760px) {
  .topbar { gap: 6px; padding-inline: 8px; }
  .topbar .brand-lockup { flex: 1; overflow: hidden; }
  .topbar .brand-lockup strong { font-size: 12px; }
  .topbar .brand-lockup img { width: 34px; height: 34px; object-fit: contain; }
  .topbar .top-actions { flex-shrink: 0; }
  .topbar .currency-select { width: 72px; padding-inline: 5px; }
  .topbar .mobile-menu-button { min-width: 44px; width: 44px; }
}
