:root {
  --bg: #13161b;
  --bg-soft: #1a2028;
  --panel: #202731;
  --panel-alt: #181d25;
  --line: #313a48;
  --text: #ebf0f5;
  --muted: #98a2b3;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.12);
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  --sidebar-width: 248px;
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #11151b 0%, #171d26 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: #c7d2fe;
}

.screen {
  min-height: 100vh;
}

.screen-login {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(24, 29, 37, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

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

.small {
  font-size: 12px;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
}

label > span {
  color: #d7dde6;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12171e;
  color: var(--text);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.14);
  color: #fecaca;
  border-color: rgba(220, 38, 38, 0.28);
}

.btn-small {
  padding: 8px 11px;
  font-size: 12px;
}

.error-text {
  color: #fca5a5;
  font-size: 13px;
}

#appView {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  height: 100vh;
  background: rgba(14, 18, 24, 0.92);
  border-right: 1px solid var(--line);
  padding: 16px 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  position: sticky;
  top: 0;
  overflow: hidden;
}

.sidebar-title {
  margin-bottom: 4px;
}

.nav {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 0;
  overflow: hidden;
}

.nav-link {
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #dce3ec;
  padding: 9px 12px;
  cursor: pointer;
}

.nav-link.active {
  background: var(--accent-soft);
  border-color: rgba(249, 115, 22, 0.24);
  color: #fff4ea;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.main {
  padding: 26px;
  display: grid;
  gap: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16);
}

.panel,
.data-card {
  background: rgba(25, 31, 40, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel.is-collapsed > :not(.panel-head) {
  display: none !important;
}

.panel-head,
.data-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-toggle {
  border: 1px solid var(--line);
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.42);
  color: var(--text);
  padding: 0;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.panel-toggle:hover {
  background: rgba(255, 107, 26, 0.18);
  opacity: 1;
}

.panel-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel.is-collapsed .panel-toggle {
  transform: rotate(-90deg);
}

.personalization-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.personalization-tool-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 14px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 46%),
    rgba(13, 18, 26, 0.78);
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.personalization-tool-card:hover {
  transform: translateY(-1px);
  border-color: rgba(249, 115, 22, 0.58);
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.1), transparent 48%),
    rgba(18, 24, 34, 0.92);
}

.personalization-tool-card.is-primary {
  border-color: rgba(249, 115, 22, 0.46);
}

.tool-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #fed7aa;
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.24);
}

.tool-card-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.personalization-tool-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.personalization-tool-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  position: relative;
  padding: 14px;
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(20, 27, 37, 0.98), rgba(12, 17, 24, 0.96));
  border: 1px solid var(--line);
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(249, 115, 22, 0.12));
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 28px;
}

.finance-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.finance-overview-compact {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  max-width: 720px;
}

.order-finance-overview {
  margin-top: 14px;
}

.finance-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 110px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(19, 27, 38, 0.98), rgba(10, 15, 22, 0.96));
  overflow: hidden;
}

.finance-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.9), rgba(148, 163, 184, 0.08));
}

.finance-viva-card {
  border-color: rgba(34, 197, 94, 0.34);
}

.finance-viva-card::before {
  background: linear-gradient(180deg, #22c55e, rgba(34, 197, 94, 0.08));
}

.finance-card strong {
  font-size: 25px;
  line-height: 1.1;
}

.finance-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.finance-card-link {
  align-self: end;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.finance-card-link:hover {
  border-color: rgba(249, 115, 22, 0.6);
  background: rgba(249, 115, 22, 0.14);
  transform: translateY(-1px);
}

.finance-icon-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 50%;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.72);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.finance-icon-button:hover {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 165, 233, 0.14);
  transform: translateY(-1px);
}

.finance-icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.finance-icon-button.is-loading svg {
  animation: spinSoft 0.9s linear infinite;
}

@keyframes spinSoft {
  to {
    transform: rotate(360deg);
  }
}

.is-hidden {
  display: none !important;
}

.alerts-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.alert-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(249, 115, 22, 0.34);
  border-radius: 8px;
  background: rgba(249, 115, 22, 0.1);
}

.alert-card strong {
  color: #fff3e8;
}

.alert-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.alert-card.alert-ok {
  border-color: rgba(22, 163, 74, 0.32);
  background: rgba(22, 163, 74, 0.1);
}

.overview-command-panel,
.overview-alert-panel {
  border-color: rgba(148, 163, 184, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 42%),
    rgba(17, 24, 34, 0.98);
}

.operational-stats-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.alert-list-industrial {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.alert-list-industrial .alert-card {
  grid-template-columns: 92px minmax(0, 1fr) minmax(150px, auto);
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(249, 115, 22, 0.075);
}

.alert-list-industrial .alert-missing {
  border-color: rgba(239, 68, 68, 0.62);
  background: rgba(239, 68, 68, 0.11);
  animation: alertRedlinePulse 1.45s ease-in-out infinite;
}

.alert-list-industrial .alert-critical {
  border-color: rgba(249, 115, 22, 0.5);
  background: rgba(249, 115, 22, 0.1);
}

.alert-list-industrial .alert-incomplete {
  border-color: rgba(168, 85, 247, 0.5);
  background: rgba(168, 85, 247, 0.1);
}

.alert-list-industrial .alert-ok {
  grid-template-columns: minmax(0, 1fr);
}

.alert-list-industrial .alert-severity {
  display: inline-flex;
  justify-content: center;
  width: fit-content;
  min-width: 78px;
  padding: 5px 8px;
  border: 1px solid rgba(249, 115, 22, 0.42);
  border-radius: 999px;
  color: #ffedd5;
  background: rgba(249, 115, 22, 0.14);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.alert-list-industrial .alert-missing .alert-severity {
  border-color: rgba(239, 68, 68, 0.72);
  color: #fee2e2;
  background: rgba(239, 68, 68, 0.2);
}

.alert-list-industrial .alert-critical .alert-severity {
  border-color: rgba(249, 115, 22, 0.52);
  color: #ffedd5;
  background: rgba(249, 115, 22, 0.16);
}

.alert-list-industrial .alert-incomplete .alert-severity {
  border-color: rgba(168, 85, 247, 0.52);
  color: #f3e8ff;
  background: rgba(168, 85, 247, 0.16);
}

.alert-list-industrial .alert-meta {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
}

@keyframes alertRedlinePulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }

  50% {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16), 0 0 22px rgba(239, 68, 68, 0.24);
  }
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

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

.channel-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  font-size: 13px;
}

.section {
  display: none;
  gap: 20px;
}

.section.active {
  display: grid;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.compact-admin-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.compact-admin-form input,
.compact-admin-form select,
.compact-admin-form textarea {
  padding: 8px 10px;
  font-size: 12px;
}

.compact-admin-form label {
  gap: 5px;
  font-size: 12px;
}

.compact-admin-form select[multiple] {
  min-height: 86px;
}

.password-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.password-field.input-with-action {
  position: relative;
  display: block;
}

.password-field.input-with-action input {
  width: 100%;
  padding-right: 76px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  min-width: 58px;
  height: 28px;
  padding: 0 10px;
  transform: translateY(-50%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  color: #d7dde6;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.password-toggle:hover,
.password-toggle.is-visible {
  color: var(--accent);
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.26);
}

.password-field.input-with-action input:disabled + .password-toggle {
  opacity: 0.34;
  cursor: not-allowed;
}

.product-form-modal {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.checkbox-row {
  align-self: end;
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

body.modal-open {
  overflow: hidden;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 14px;
}

.modal-shell[hidden] {
  display: none;
}

[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 12, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  max-height: min(94vh, 960px);
  overflow: auto;
  background: rgba(25, 31, 40, 0.99);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.48);
  padding: 12px;
}

.featured-replace-card {
  width: min(560px, 100%);
}

.featured-replace-body {
  display: grid;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.featured-replace-body p {
  margin: 0;
  line-height: 1.5;
}

.featured-replace-body strong {
  color: var(--text);
}

.featured-replace-list {
  display: grid;
  gap: 8px;
}

.featured-replace-option {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 14, 19, 0.46);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.featured-replace-option:hover {
  border-color: rgba(249, 115, 22, 0.7);
  background: rgba(249, 115, 22, 0.1);
}

.featured-replace-thumb {
  width: 56px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: #0c1117;
  border: 1px solid var(--line);
}

.featured-replace-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-replace-option strong,
.featured-replace-option small {
  display: block;
}

.featured-replace-option small {
  color: var(--muted);
  margin-top: 3px;
}

.featured-replace-option em {
  font-style: normal;
  color: #fed7aa;
  font-size: 12px;
  font-weight: 800;
}

.featured-replace-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-head {
  position: sticky;
  top: -12px;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: -12px -12px 10px;
  padding: 12px;
  background: rgba(25, 31, 40, 0.96);
  border-bottom: 1px solid var(--line);
}

.product-modal-card input,
.product-modal-card select,
.product-modal-card textarea {
  padding: 8px 10px;
  font-size: 12px;
}

.product-modal-card label {
  gap: 5px;
  font-size: 12px;
}

.product-modal-card textarea {
  min-height: 72px;
}

.product-form-modal .upload-helper {
  display: none;
}

.product-form-modal .gallery-panel {
  min-width: 0;
}

.catalog-filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 31, 40, 0.98);
  box-shadow: var(--shadow);
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.filter-panel label {
  gap: 5px;
  font-size: 12px;
}

.filter-panel input,
.filter-panel select {
  padding: 8px 10px;
  font-size: 12px;
}

.material-filter-panel {
  grid-template-columns: minmax(220px, 1.5fr) repeat(5, minmax(120px, 1fr));
}

.client-filter-panel {
  grid-template-columns: minmax(220px, 1.8fr) repeat(3, minmax(130px, 1fr));
}

.list-filter-panel {
  margin-top: -8px;
}

.catalog-filter-panel label {
  gap: 5px;
  font-size: 12px;
}

.catalog-filter-panel input,
.catalog-filter-panel select {
  padding: 8px 10px;
  font-size: 12px;
}

.product-table-wrap {
  min-width: 0;
}

.row-warning {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding: 3px 7px;
  border: 1px solid rgba(249, 115, 22, 0.38);
  border-radius: 999px;
  color: #fed7aa;
  background: rgba(249, 115, 22, 0.1);
  font-size: 10px;
  font-weight: 800;
}

.product-db-panel {
  overflow: auto;
  background: rgba(25, 31, 40, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-db-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-db-table {
  min-width: 980px;
}

.clickable-row {
  cursor: pointer;
}

.product-db-table th,
.product-db-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.product-db-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #151b23;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product-db-table tr:hover td {
  background: rgba(249, 115, 22, 0.05);
}

.product-db-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.orders-db-panel {
  border-color: rgba(148, 163, 184, 0.18);
}

.orders-table {
  min-width: 1160px;
}

.discount-panel {
  margin-top: 18px;
}

.discount-form-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.8fr 0.7fr 0.8fr 0.85fr 0.85fr;
  gap: 12px;
  align-items: end;
}

.discount-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.discount-form-grid input,
.discount-form-grid select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  padding: 0 12px;
  font-weight: 800;
}

.discount-code-line {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.icon-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.icon-mini-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.discount-description-field {
  grid-column: span 2;
}

.discount-code-grid {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.discount-code-row {
  display: grid;
  grid-template-columns: 1.1fr 0.7fr 0.7fr 0.7fr 1fr 44px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.discount-code-row code {
  color: #fff;
  font-weight: 900;
}

.discount-code-row small {
  color: var(--muted);
}

.order-row.is-urgent td {
  animation: orderDeadlinePulse 1.7s ease-in-out infinite;
}

.order-row.is-overdue td {
  background: rgba(239, 68, 68, 0.08);
}

.order-row.is-overdue:hover td {
  background: rgba(239, 68, 68, 0.12);
}

@keyframes orderDeadlinePulse {
  0%,
  100% {
    background: rgba(249, 115, 22, 0.03);
  }
  50% {
    background: rgba(249, 115, 22, 0.13);
  }
}

.order-status-select,
.order-modal-actions select,
.order-modal-actions input,
.order-modal-actions textarea,
.order-delete-form input {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(8, 13, 20, 0.78);
  font: inherit;
  font-size: 12px;
}

.order-status-select {
  min-width: 180px;
}

.order-due-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 999px;
  color: #fed7aa;
  background: rgba(249, 115, 22, 0.09);
  font-size: 11px;
  font-weight: 850;
}

.icon-danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 36px;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(244, 63, 94, 0.42);
  border-radius: 9px;
  color: #ffe4e6;
  background: rgba(190, 18, 60, 0.18);
  cursor: pointer;
  font-weight: 900;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.icon-danger-btn:hover {
  border-color: rgba(244, 63, 94, 0.74);
  background: rgba(190, 18, 60, 0.28);
  transform: translateY(-1px);
}

.icon-danger-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.order-modal-card {
  width: min(1040px, calc(100% - 28px));
  max-height: min(88vh, 860px);
}

.order-modal-body {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding-right: 4px;
}

.order-modal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.order-modal-summary div,
.order-address-grid article,
.order-item-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 20, 0.44);
  padding: 12px;
}

.order-modal-summary span,
.order-modal-actions span,
.order-address-grid h4,
.order-modal-items h4 {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.order-modal-summary strong {
  display: block;
  font-size: 15px;
}

.order-modal-summary small,
.order-item-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.order-address-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.order-address-grid address {
  display: grid;
  gap: 4px;
  color: var(--text);
  font-style: normal;
  font-size: 12px;
  line-height: 1.45;
}

.order-address-grid address span {
  display: block;
}

.order-modal-items {
  display: grid;
  gap: 10px;
}

.order-item-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: start;
}

.order-tech-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 0;
}

.order-tech-list div {
  min-width: 0;
}

.order-tech-list dt {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.order-tech-list dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 12px;
  word-break: break-word;
}

.order-tech-description {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.order-modal-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px auto auto;
  gap: 10px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.order-modal-actions .full {
  grid-column: 1 / 3;
}

.order-delete-card {
  width: min(460px, calc(100% - 28px));
}

.order-delete-form {
  display: grid;
  gap: 14px;
}

.order-delete-form p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.order-delete-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-delete-submit {
  min-width: 118px;
}

@media (max-width: 900px) {
  .order-modal-summary,
  .order-address-grid,
  .order-item-card,
  .order-modal-actions {
    grid-template-columns: 1fr;
  }

  .order-modal-actions .full {
    grid-column: auto;
  }
}

.row-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.admin-record-modal-card {
  width: min(920px, 100%);
}

.record-modal-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.record-modal-form textarea {
  min-height: 74px;
}

.modal-actions-row {
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.color-picker-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.color-picker-row input[type="color"] {
  width: 46px;
  height: 38px;
  padding: 2px;
  border-radius: 8px;
}

.color-value {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(9, 12, 16, 0.72);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.dynamic-color-options,
.dynamic-filament-options {
  display: contents;
}

.material-type-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.material-type-svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: #f97316;
  filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.22));
}

.stock-low-row td {
  background: rgba(249, 115, 22, 0.07);
}

.stock-missing-row td {
  background: rgba(220, 38, 38, 0.09);
  animation: alertRedlinePulse 1.45s ease-in-out infinite;
}

.stock-pulse {
  animation: alertRedlinePulse 1.45s ease-in-out infinite;
}

.product-row-button {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 0;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.product-row-button strong,
.product-row-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-row-button small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.product-thumb {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  overflow: hidden;
  background: #0c1117;
  border: 1px solid var(--line);
}

.product-thumb img,
.product-thumb video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
  display: block;
}

.color-fieldset,
.filament-fieldset,
.material-location-fieldset {
  grid-column: span 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
}

.color-fieldset legend,
.filament-fieldset legend,
.material-location-fieldset legend {
  padding: 0 6px;
  color: #d7dde6;
  font-size: 13px;
}

.color-fieldset label,
.filament-fieldset label,
.material-location-fieldset label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(10, 14, 19, 0.42);
  cursor: pointer;
}

.color-fieldset input,
.filament-fieldset input,
.material-location-fieldset input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-fieldset label::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--dot-color, #6b7280);
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.color-fieldset label:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.manual-color-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.manual-color-picker input[type="color"] {
  position: static;
  opacity: 1;
  pointer-events: auto;
  width: 34px;
  height: 34px;
  padding: 2px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 14, 19, 0.8);
  cursor: pointer;
}

.manual-color-picker .btn {
  height: 34px;
  white-space: nowrap;
}

.selected-color-strip {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.selected-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.74);
  color: #d7dde6;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.selected-color-chip:hover {
  border-color: rgba(239, 68, 68, 0.48);
  color: #fee2e2;
  background: rgba(239, 68, 68, 0.1);
}

.selected-color-chip strong {
  color: #fb7185;
  font-size: 13px;
  line-height: 1;
}

.color-fieldset .selected-color-strip span {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
}

.color-fieldset span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.filament-fieldset,
.material-location-fieldset {
  align-content: start;
}

.filament-fieldset label,
.material-location-fieldset label {
  width: auto;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #dfe7f2;
  font-size: 11px;
  font-weight: 800;
}

.filament-fieldset label:has(input:checked),
.material-location-fieldset label:has(input:checked) {
  border-color: rgba(249, 115, 22, 0.8);
  color: #fff;
  background: rgba(249, 115, 22, 0.16);
}

.filament-fieldset span,
.material-location-fieldset span {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
}

.color-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 68px;
  align-items: center;
}

.color-dot {
  display: inline-flex;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dot-color, #6b7280);
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.color-fieldset .selected-color-strip .color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  overflow: visible;
  clip: auto;
}

.filament-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 120px;
}

.filament-chip {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #dfe7f2;
  background: rgba(10, 14, 19, 0.4);
  font-size: 10px;
  font-weight: 800;
}

.meta-divider {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.meta-subtitle {
  margin: 0;
}

.upload-helper {
  margin-top: -6px;
}

.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.input-with-action .btn {
  min-height: 42px;
}

.model-files-section {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
}

.model-files-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.model-files-head > div > span {
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
}

.model-files-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.model-file-picker {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.model-file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.model-files-manager {
  display: grid;
  gap: 8px;
}

.model-files-empty {
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}

.model-file-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(10, 14, 19, 0.46);
}

.model-file-type {
  display: grid;
  place-items: center;
  min-height: 32px;
  border-radius: 5px;
  color: #ffd8bf;
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 900;
}

.model-file-info {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.model-file-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.model-file-info small,
.model-file-new {
  color: var(--muted);
  font-size: 11px;
}

.model-file-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.admin-product-reference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 320px;
  padding: 10px 0 3px;
}

.admin-product-reference span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.admin-makerworld-link {
  display: inline-flex;
  margin-top: 10px;
  color: #ffb184;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 640px) {
  .model-files-head,
  .model-file-actions {
    flex-direction: column;
  }

  .model-file-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .model-file-actions {
    grid-column: 1 / -1;
    align-items: stretch;
  }
}

.gallery-manager {
  display: grid;
  gap: 8px;
}

.gallery-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(18, 23, 30, 0.55);
}

.gallery-viewer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
  overflow: hidden;
  display: grid;
  gap: 8px;
  padding: 8px;
}

.gallery-viewer-image {
  position: relative;
  height: 112px;
  overflow: hidden;
  border-radius: 6px;
  background: #0f1319;
}

.gallery-viewer-image img,
.gallery-viewer-image video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
  display: block;
}

.gallery-viewer-image span {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 4px 7px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  font-size: 10px;
  font-weight: 800;
}

.gallery-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gallery-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.gallery-strip button {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #0f1319;
  cursor: pointer;
}

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

.gallery-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-preview {
  width: 100%;
  height: 82px;
  object-fit: cover;
  display: block;
  background: #0f1319;
}

.gallery-card-body {
  padding: 8px;
  display: grid;
  gap: 8px;
}

.gallery-card-title {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.gallery-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gallery-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.product-card-editor {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.product-card-editor-head,
.product-card-editor-layout {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.product-card-editor-head {
  align-items: flex-start;
  margin-bottom: 8px;
}

.product-card-editor-head > div > span {
  display: block;
  font-weight: 800;
  margin-bottom: 4px;
}

.product-card-editor-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.product-card-editor-layout {
  align-items: stretch;
}

.product-modal-card .admin-store-preview {
  width: min(178px, 100%);
}

.product-modal-card .admin-store-preview-info {
  padding: 12px;
}

.product-modal-card .admin-store-preview-info h4 {
  font-size: 16px;
}

.product-modal-card .admin-store-preview-info p {
  margin-bottom: 10px;
  font-size: 11px;
}

.product-modal-card .admin-store-preview-info > div span {
  padding: 6px 9px;
}

.product-modal-card .product-crop-controls {
  gap: 8px;
  padding: 10px;
}

.product-modal-card .product-crop-controls label {
  gap: 5px;
}

.product-modal-card .product-crop-controls p {
  margin: 0;
}

.admin-store-preview {
  position: relative;
  width: min(330px, 100%);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090c10;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.admin-store-preview.dragging {
  cursor: grabbing;
}

.admin-product-summary {
  width: 100%;
  max-width: 320px;
  cursor: default;
}

.admin-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.admin-product-meta span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}

.admin-product-meta .model-source-missing {
  color: #ffb3b3;
  border-color: rgba(255, 92, 92, 0.35);
}

.admin-store-preview > img,
.admin-store-preview > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
  transform-origin: center;
  pointer-events: none;
}

.admin-store-preview > video {
  pointer-events: auto;
}

.gallery-strip video,
.gallery-strip img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
}

.category-admin-tools {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 110px minmax(220px, 1fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.category-admin-tools .category-name-field,
.category-admin-tools .category-url-field {
  min-width: 0;
}

.category-admin-tools .category-image-field input {
  padding-top: 10px;
}

.category-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
}

.category-admin-list {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-admin-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 320px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.category-admin-card.has-category-url {
  border-color: rgba(255, 122, 26, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 122, 26, 0.12);
}

.category-admin-card:hover,
.category-admin-card:focus-visible {
  border-color: rgba(255, 122, 26, 0.6);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  outline: none;
  transform: translateY(-1px);
}

.category-admin-card.is-editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.42), 0 14px 32px rgba(255, 122, 26, 0.12);
}

.category-admin-thumb {
  width: 52px;
  height: 42px;
  flex: 0 0 52px;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  letter-spacing: 0.12em;
  font-size: 10px;
}

.category-admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
}

.category-card-editor {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.category-card-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.category-card-editor-head div {
  display: grid;
  gap: 3px;
}

.category-card-editor-head strong {
  font-size: 13px;
}

.category-card-editor-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.category-card-editor-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
  max-width: 780px;
}

.admin-category-preview {
  position: relative;
  display: block;
  width: min(260px, 100%);
  max-width: 100%;
  height: 150px;
  min-height: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  cursor: default;
  box-shadow: none;
  padding: 0;
}

.admin-category-preview .store-category-image {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.22), rgba(0, 0, 0, 0.34));
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.admin-category-preview .store-category-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  display: block;
}

.admin-category-preview .store-category-name {
  position: absolute;
  inset: auto 0 0;
  padding: 44px 16px 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.74));
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.08;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

.compact-category-crop {
  min-height: 150px;
  padding: 12px;
  gap: 10px;
  align-content: start;
}

.compact-category-crop label {
  gap: 6px;
}

.compact-category-crop input[type="range"] {
  min-height: 26px;
}

.icon-collapse-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.icon-collapse-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.icon-collapse-btn:hover {
  border-color: rgba(255, 122, 26, 0.62);
  color: var(--accent);
}

.category-admin-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.category-admin-meta strong,
.category-admin-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-admin-meta small {
  color: var(--muted);
  font-weight: 600;
}

.category-admin-card button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.category-admin-card button:hover {
  color: var(--danger);
}

@media (max-width: 980px) {
  .category-admin-tools {
    grid-template-columns: 1fr;
  }
}

.admin-store-preview-info {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  padding: 18px;
  color: #fff;
  isolation: isolate;
  background: transparent;
}

.admin-store-preview-info::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -170px 0 0;
  pointer-events: none;
  background: linear-gradient(to bottom,
    rgba(6, 9, 13, 0) 0%,
    rgba(6, 9, 13, 0.03) 18%,
    rgba(6, 9, 13, 0.12) 34%,
    rgba(6, 9, 13, 0.34) 52%,
    rgba(6, 9, 13, 0.68) 72%,
    rgba(6, 9, 13, 0.94) 90%,
    rgba(6, 9, 13, 0.98) 100%);
  backdrop-filter: blur(24px) saturate(1.12);
  -webkit-backdrop-filter: blur(24px) saturate(1.12);
  mask-image: linear-gradient(to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.04) 16%,
    rgba(0, 0, 0, 0.16) 32%,
    rgba(0, 0, 0, 0.42) 50%,
    rgba(0, 0, 0, 0.72) 68%,
    #000 88%);
  -webkit-mask-image: linear-gradient(to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.04) 16%,
    rgba(0, 0, 0, 0.16) 32%,
    rgba(0, 0, 0, 0.42) 50%,
    rgba(0, 0, 0, 0.72) 68%,
    #000 88%);
}

.admin-store-preview-info small {
  color: #ff9c61;
  font-weight: 800;
}

.admin-store-preview-info h4 {
  margin: 8px 0 5px;
  font-size: 20px;
}

.admin-store-preview-info p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-store-preview-info > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-store-preview-info > div span {
  padding: 8px 11px;
  border-radius: 999px;
  color: #111;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.product-crop-controls {
  flex: 1;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
}

.product-crop-controls label {
  display: grid;
  gap: 8px;
}

.product-crop-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

@media (max-width: 720px) {
  .product-card-editor-layout {
    flex-direction: column;
  }

  .admin-store-preview {
    margin: 0 auto;
  }
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.data-card {
  padding: 16px;
}

.badge {
  border-radius: 999px;
  background: var(--accent-soft);
  color: #ffd9bf;
  border: 1px solid rgba(249, 115, 22, 0.25);
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.badge.meta-ok {
  background: rgba(22, 163, 74, 0.14);
  color: #bbf7d0;
  border-color: rgba(22, 163, 74, 0.3);
}

.badge.meta-warn {
  background: rgba(249, 115, 22, 0.14);
  color: #fed7aa;
  border-color: rgba(249, 115, 22, 0.32);
}

.badge.meta-fail {
  background: rgba(220, 38, 38, 0.14);
  color: #fecaca;
  border-color: rgba(220, 38, 38, 0.28);
}

.card-kicker {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.card-title {
  margin-bottom: 8px;
}

.card-body {
  color: #d5dde8;
  font-size: 13px;
  display: grid;
  gap: 8px;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

.home-media-controls {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.home-media-upload input {
  padding: 12px;
}

.home-media-gallery {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.home-media-selected,
.home-media-strip button,
.home-media-empty {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.62);
}

.home-media-selected,
.home-media-strip button {
  overflow: hidden;
}

.home-media-selected img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #0b111b;
}

.home-media-selected button {
  width: calc(100% - 16px);
  margin: 8px;
}

.home-media-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  align-content: start;
}

.home-media-strip button {
  padding: 0;
  cursor: pointer;
  opacity: 0.7;
}

.home-media-strip button.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.18);
}

.home-media-strip img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.home-media-empty {
  grid-column: 1 / -1;
  padding: 18px;
  color: var(--muted);
}

.admin-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 14px 0 6px;
}

.admin-pagination button,
.admin-pagination span,
.admin-pagination small {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.74);
  color: var(--text);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}

.admin-pagination button {
  cursor: pointer;
}

.admin-pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.admin-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 1080px) {
  :root {
    --sidebar-width: 220px;
  }

  body.is-tablet {
    font-size: 15px;
  }

  body.is-tablet .main {
    padding: 20px;
  }

  .stats-grid,
  .finance-overview,
  .grid-two,
  .cards-grid,
  .form-grid,
  .compact-admin-form,
  .personalization-tools-grid,
  .alerts-list,
  .home-media-gallery {
    grid-template-columns: 1fr 1fr;
  }

  .catalog-filter-panel,
  .filter-panel,
  .material-filter-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  #appView {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    min-height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    padding: 10px 14px;
    gap: 10px;
  }

  .sidebar > div:first-child {
    min-width: 132px;
  }

  .sidebar-title {
    font-size: 20px;
  }

  .sidebar-footer {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    white-space: nowrap;
    min-height: 38px;
    padding: 9px 12px;
  }

  .header {
    flex-direction: column;
  }

  .product-db-table {
    min-width: 900px;
  }

  .modal-card {
    width: min(96vw, 980px);
    max-height: 92vh;
    overflow: auto;
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: 78px;
  }

  #appView {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    height: 74px;
    grid-template-columns: 1fr;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgba(9, 13, 18, 0.96);
    box-shadow: 0 -16px 44px rgba(0, 0, 0, 0.38);
  }

  .sidebar > div:first-child,
  .sidebar-footer {
    display: none;
  }

  .nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(82px, 1fr);
    gap: 6px;
    overflow-x: auto;
    padding: 0;
  }

  .nav-link {
    min-height: 56px;
    padding: 7px 6px;
    text-align: center;
    font-size: 11px;
    line-height: 1.15;
    display: grid;
    place-items: center;
  }

  .main {
    padding: 14px 12px 22px;
    gap: 14px;
  }

  .header {
    gap: 10px;
  }

  .header h1 {
    font-size: 28px;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .status-pill,
  .header-actions .btn {
    justify-content: center;
    width: 100%;
  }

  .panel {
    padding: 14px;
  }

  .panel-head {
    align-items: center;
  }

  .panel-head h3 {
    font-size: 18px;
  }

  .btn {
    min-height: 42px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .stats-grid,
  .finance-overview,
  .grid-two,
  .cards-grid,
  .form-grid,
  .compact-admin-form,
  .personalization-tools-grid,
  .alerts-list,
  .home-media-controls,
  .home-media-gallery,
  .catalog-filter-panel,
  .filter-panel,
  .material-filter-panel,
  .record-modal-form {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .product-db-panel {
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .product-db-table,
  .product-db-table thead,
  .product-db-table tbody,
  .product-db-table tr,
  .product-db-table th,
  .product-db-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .product-db-table thead {
    display: none;
  }

  .product-db-table tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(25, 31, 40, 0.98);
    overflow: hidden;
  }

  .product-db-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(49, 58, 72, 0.72);
    text-align: right;
  }

  .product-db-table td:last-child {
    border-bottom: 0;
  }

  .product-db-table td::before {
    content: "Campo";
    flex: 0 0 92px;
    color: var(--muted);
    text-align: left;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .product-db-table td:nth-child(1)::before { content: "Item"; }
  .product-db-table td:nth-child(2)::before { content: "Ref."; }
  .product-db-table td:nth-child(3)::before { content: "Categoria"; }
  .product-db-table td:nth-child(4)::before { content: "Preco"; }
  .product-db-table td:nth-child(5)::before { content: "Stock"; }
  .product-db-table td:nth-child(6)::before { content: "Estado"; }
  .product-db-table td:nth-child(7)::before { content: "Shop"; }
  .product-db-table td:nth-child(8)::before { content: "Home"; }
  .product-db-table td:nth-child(9)::before { content: "Fotos"; }
  .product-db-table td:nth-child(10)::before { content: "Ficheiros"; }
  .product-db-table td:nth-child(11)::before { content: "Cores"; }
  .product-db-table td:nth-child(12)::before { content: "Filamento"; }

  .product-row-button {
    width: 100%;
  }

  .modal-shell {
    align-items: end;
  }

  .modal-card {
    width: 100vw;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    overflow: auto;
  }

  .modal-head {
    position: sticky;
    top: 0;
    z-index: 3;
    background: rgba(25, 31, 40, 0.98);
    border-bottom: 1px solid var(--line);
  }

  .product-card-editor-layout,
  .gallery-panel,
  .model-files-head,
  .category-admin-tools .input-with-action {
    grid-template-columns: 1fr;
  }

  .admin-pagination {
    gap: 6px;
  }

  .admin-pagination button,
  .admin-pagination small {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 11px;
  }
}
