:root {
  --bg: #f4efe8;
  --bg-alt: #fffaf4;
  --panel: rgba(255, 255, 255, 0.82);
  --text: #1d1b19;
  --muted: #6b6258;
  --line: rgba(33, 28, 24, 0.12);
  --brand: #164b42;
  --brand-2: #d96c2b;
  --shadow: 0 20px 60px rgba(25, 18, 14, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top left, rgba(217, 108, 43, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(22, 75, 66, 0.10), transparent 32%),
    linear-gradient(180deg, #fffdf9 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

body.modal-open {
  overflow: hidden;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

body.storefront .shell {
  padding-bottom: 112px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 24px rgba(22, 75, 66, 0.22);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-form {
  margin: 0;
}

.nav a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
}

.nav a.active,
.nav a:hover {
  color: var(--text);
  background: rgba(22, 75, 66, 0.08);
}

.mobile-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 30;
  width: min(560px, calc(100% - 20px));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.96);
  box-shadow: 0 18px 40px rgba(25, 18, 14, 0.14);
  backdrop-filter: blur(16px);
}

.mobile-nav a {
  display: grid;
  place-items: center;
  min-height: 54px;
  border-radius: 16px;
  color: var(--muted);
  font-weight: 700;
}

.mobile-nav a.active {
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.content {
  display: grid;
  gap: 24px;
}

.hero, .detail, .cart-layout, .admin-grid, .metrics {
  display: grid;
  gap: 20px;
}

.hero {
  grid-template-columns: 1.4fr 0.8fr;
  align-items: stretch;
}

.hero > div, .hero-card, .panel, .note, .success-card, .summary {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero > div {
  padding: 32px;
}

.hero-card {
  padding: 24px;
  display: grid;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand-2);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

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

h1 {
  font-size: clamp(2.2rem, 4vw, 4.4rem);
  line-height: 1.03;
  margin-bottom: 16px;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 58ch;
}

.hero-actions, .page-head, .section-head, .price-row, .summary-row, .product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
}

.button.primary {
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.button.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.64);
}

.button.compact {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.button.danger {
  color: #8f2a13;
}

.stat {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.stat span, .metric-card span, .summary-row span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat strong, .metric-card strong {
  display: block;
  font-size: 1.6rem;
  margin-top: 8px;
}

.section-head {
  margin: 8px 0 0;
}

.section-head.compact {
  margin: 0 0 10px;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.export-template-hint {
  margin: -2px 0 0;
  line-height: 1.45;
}

.catalog-hero {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.catalog-head {
  margin: 0;
}

.catalog-head .lead {
  margin-bottom: 0;
}

.catalog-search {
  display: grid;
  gap: 10px;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-row input {
  min-width: 0;
}

.catalog-hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.catalog-categories {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.catalog-categories::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 700;
}

.chip.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

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

.product-card {
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.product-card a {
  display: grid;
  height: 100%;
}

.product-card img {
  aspect-ratio: 1.15;
  object-fit: cover;
}

.product-body {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.tag {
  margin: 0;
  font-size: 0.8rem;
  color: var(--brand);
  font-weight: 700;
}

.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  border: 1px solid var(--line);
}

.status-tag.success {
  color: #12632d;
  background: rgba(18, 99, 45, 0.08);
  border-color: rgba(18, 99, 45, 0.2);
}

.status-tag.danger {
  color: #8f2a13;
  background: rgba(143, 42, 19, 0.08);
  border-color: rgba(143, 42, 19, 0.2);
}

.desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.product-meta strong, .price-row strong {
  font-size: 1.25rem;
}

.note {
  padding: 28px;
}

.profile {
  display: grid;
  gap: 18px;
}

.profile-card, .profile-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.profile-card {
  padding: 28px;
}

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

.profile-panel {
  padding: 22px;
}

.profile-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-panel strong {
  display: block;
  font-size: 1.2rem;
  margin: 8px 0 10px;
}

.detail {
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.detail-media img {
  border-radius: 28px;
  aspect-ratio: 1.15;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.detail-info {
  padding: 10px;
}

.buy-box, .checkout-form, .admin-form {
  display: grid;
  gap: 14px;
}

.payment-card-box {
  display: grid;
  gap: 14px;
  margin-top: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
}

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

.payment-card-summary {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(22, 75, 66, 0.08), rgba(217, 108, 43, 0.08));
  border: 1px solid rgba(33, 28, 24, 0.08);
}

.payment-card-summary p {
  margin-bottom: 0;
  color: var(--muted);
}

.payment-card-state {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.payment-card-state.ready {
  color: #1b6b37;
  background: rgba(27, 107, 55, 0.12);
}

.payment-card-state.pending {
  color: #9a4a14;
  background: rgba(217, 108, 43, 0.14);
}

.image-section {
  display: grid;
  gap: 12px;
}

.sr-only-upload {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.image-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 14px 30px rgba(25, 18, 14, 0.08);
  cursor: grab;
}

.image-tile.dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

.image-tile.highlight {
  border-color: rgba(217, 108, 43, 0.55);
  box-shadow: 0 0 0 3px rgba(217, 108, 43, 0.12);
}

.image-tile-preview {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.image-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 0;
}

.image-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: rgba(29, 27, 25, 0.72);
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  transform: translateY(-4px);
}

.image-tile:hover .image-delete,
.image-tile:focus-within .image-delete {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.image-drag-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(29, 27, 25, 0.62);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.image-tile-add {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 16px;
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(250, 243, 233, 0.96));
  color: var(--muted);
  cursor: pointer;
}

.image-add-icon {
  font-size: 2.2rem;
  line-height: 1;
  color: var(--brand);
}

.image-add-text {
  font-size: 0.92rem;
  font-weight: 700;
}

.thumb-cell {
  width: 92px;
}

.table-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  display: block;
}

.products-table tbody tr {
  height: 108px;
}

.products-table td {
  padding-top: 18px;
  padding-bottom: 18px;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 13, 10, 0.72);
}

.image-modal.show {
  display: flex;
}

.image-modal img {
  max-width: min(100%, 980px);
  max-height: 88vh;
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  background: white;
}

.image-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.product-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(17, 13, 10, 0.7);
}

.product-modal.show {
  display: flex;
}

.product-modal-dialog {
  width: min(1120px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 250, 244, 0.98);
  box-shadow: 0 28px 90px rgba(18, 14, 11, 0.35);
  padding: 24px;
}

.product-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.product-modal-header h2 {
  margin-bottom: 0;
}

.product-modal-close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

.product-modal .admin-form {
  max-width: none;
}

.manifest-import-modal .product-modal-dialog {
  width: min(1080px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manifest-import-frame {
  width: 100%;
  flex: 1 1 auto;
  min-height: 72vh;
  height: calc(92vh - 130px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 244, 0.98);
}

.export-template-dialog {
  width: min(560px, 100%);
}

.export-template-form input[type="file"] {
  background: rgba(255, 255, 255, 0.92);
}

.mobile-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(17, 13, 10, 0.76);
}

.mobile-preview-modal.show {
  display: flex;
}

.mobile-preview-dialog {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 250, 244, 0.98);
  box-shadow: 0 28px 90px rgba(18, 14, 11, 0.35);
  padding: 24px;
}

.mobile-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.mobile-preview-header h2 {
  margin-bottom: 0;
}

.mobile-preview-shell {
  display: grid;
  place-items: center;
  padding: 8px 0 4px;
}

.mobile-preview-phone {
  position: relative;
  width: min(390px, 100%);
  aspect-ratio: 390 / 844;
  padding: 22px 12px 14px;
  border-radius: 40px;
  background:
    linear-gradient(145deg, #0d1217 0%, #2d333a 48%, #06080a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 18px 28px rgba(255, 255, 255, 0.08),
    0 30px 80px rgba(0, 0, 0, 0.42);
}

.mobile-preview-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 34%;
  height: 20px;
  border-radius: 999px;
  background: rgba(5, 7, 10, 0.95);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.08);
}

.mobile-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 30px;
  background: white;
  display: block;
}

.category-modal-dialog {
  width: min(560px, 100%);
}

.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
}

.carousel-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  margin: 0;
  scroll-snap-align: start;
}

.carousel-slide img,
.detail-image-item img {
  width: 100%;
  display: block;
}

.carousel-slide img {
  aspect-ratio: 1.1;
  object-fit: cover;
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 250, 244, 0.92);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(25, 18, 14, 0.16);
}

.carousel-control.prev {
  left: 12px;
}

.carousel-control.next {
  right: 12px;
}

.carousel-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 14px 0 0;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 75, 66, 0.22);
}

.carousel-dot.active {
  width: 28px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.detail-stack {
  display: grid;
  gap: 16px;
}

.detail-images {
  display: grid;
  gap: 12px;
}

.detail-image-item {
  margin: 0;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.detail-image-item img {
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
}

label.has-error {
  color: #9f2411;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: #d13b1f;
  box-shadow: 0 0 0 3px rgba(209, 59, 31, 0.12);
}

.field-error {
  color: #b42d16;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.field-error.full {
  padding: 12px 14px;
  border: 1px solid rgba(209, 59, 31, 0.24);
  border-radius: 16px;
  background: rgba(209, 59, 31, 0.08);
}

.modal-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.cart-layout {
  grid-template-columns: 1.2fr 0.8fr;
}

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

.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.cart-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 18px;
}

.summary {
  padding: 24px;
  align-self: start;
}

.summary-row {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.summary-row.total {
  border-bottom: 0;
  padding-top: 16px;
  font-size: 1.05rem;
}

.product-url-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.empty-state, .success {
  padding: 40px;
  text-align: center;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.success-card {
  margin: 24px auto;
  padding: 24px;
  width: min(560px, 100%);
  text-align: left;
}

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

.metric-card, .panel {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.auth-layout {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 220px);
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.admin-grid {
  grid-template-columns: 1fr 1fr;
}

.admin-grid.single {
  grid-template-columns: 1fr;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap table {
  min-width: 100%;
}

.products-table {
  width: 100%;
  table-layout: fixed;
}

.products-table th,
.products-table td {
  vertical-align: top;
  white-space: normal;
}

.products-table .col-select { width: 46px; }
.products-table .col-thumb { width: 84px; }
.products-table .col-name { width: 24%; }
.products-table .col-sku { width: 18%; }
.products-table .col-category { width: 11%; }
.products-table .col-image-status { width: 9%; }
.products-table .col-price { width: 9%; }
.products-table .col-stock { width: 7%; }
.products-table .col-actions { width: 168px; }

.users-table .col-username { width: 20%; }
.users-table .col-display-name { width: 18%; }
.users-table .col-role { width: 12%; }
.users-table .col-status { width: 12%; }
.users-table .col-created { width: 18%; }
.users-table .col-actions { width: 20%; }

.products-table th {
  padding: 12px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.products-table td {
  padding: 12px 8px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.products-table tbody tr {
  height: 96px;
}

.products-table .thumb-cell {
  vertical-align: middle;
}

.products-table .table-thumb {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.product-name-cell {
  font-weight: 600;
}

.product-name-text {
  display: -webkit-box;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.product-sku-cell,
.product-category-cell,
.product-stock-cell,
.product-image-status-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-sku-cell {
  font-size: 0.82rem;
  color: var(--muted);
}

.users-table tbody tr {
  height: 88px;
}

.user-username-cell {
  font-weight: 700;
}

.user-state {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.user-state.active {
  color: #1b6b37;
  background: rgba(27, 107, 55, 0.10);
}

.user-state.inactive {
  color: #9f2411;
  background: rgba(159, 36, 17, 0.10);
}

.user-modal-dialog {
  width: min(620px, 100%);
}

.product-category-cell,
.product-stock-cell {
  color: var(--muted);
}

.product-price-cell {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-weight: 700;
  vertical-align: middle;
}

.money-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
  width: 100%;
}

.money-currency {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.money-amount {
  display: block;
  font-size: 1rem;
  font-weight: 800;
}

.product-image-status-cell,
.product-stock-cell {
  text-align: center;
}

.select-cell {
  width: 46px;
  text-align: center;
  vertical-align: middle !important;
}

.select-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.categories-table .col-name {
  width: auto;
}

.categories-table th,
.categories-table td {
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1.05;
}

.categories-table tbody tr {
  height: 42px;
}

.categories-table td {
  vertical-align: middle;
}

.categories-table .row-actions {
  padding-top: 0;
  gap: 4px;
  min-width: 0;
  align-items: center;
}

.categories-table .button.compact {
  min-height: 24px;
  padding: 0 8px;
  font-size: 0.76rem;
}

.categories-table .row-actions form .button.compact {
  min-width: 46px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 16px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.action-cell {
  vertical-align: top;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
  flex-wrap: wrap;
  padding-top: 0;
}

.row-actions form {
  margin: 0;
  display: inline-flex;
}

.products-table .row-actions .button.compact {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.products-table .row-actions form .button.compact {
  min-width: 48px;
}

.order-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  margin: 12px 0 16px;
}

.image-import-form {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.image-import-button {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.image-import-button input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.order-filter-bar input,
.order-filter-bar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
}

.order-filter-bar input {
  flex: 1 1 auto;
  min-width: 0;
}

.order-filter-bar select {
  flex: 0 0 160px;
  width: 160px;
}

.order-filter-bar .filter-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 8px;
  margin-left: auto;
}

.admin-grid.single > .panel {
  width: 100%;
  max-width: 100%;
}

.admin-grid.single > .panel > .table-wrap,
.admin-grid.single > .panel > .section-foot,
.admin-grid.single > .panel > .order-filter-bar {
  width: 100%;
}

.admin-grid.single > .panel > .table-wrap {
  overflow-x: auto;
}

@media (max-width: 980px) {
  .order-filter-bar {
    flex-wrap: wrap;
  }

  .order-filter-bar input {
    flex-basis: min(100%, 420px);
  }

  .order-filter-bar select {
    flex: 0 0 120px;
    width: 120px;
  }

  .order-filter-bar .filter-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-left: 0;
    width: 100%;
  }
}

.orders-table {
  width: 100%;
  min-width: 1040px;
}

.orders-table .col-select { width: 46px; }
.orders-table .col-order-number { width: 220px; }
.orders-table .col-recipient { width: 110px; }
.orders-table .col-phone { width: 120px; }
.orders-table .col-tracking { width: 150px; }
.orders-table .col-created { width: 170px; }
.orders-table .col-total { width: 120px; }
.orders-table .col-delete-status { width: 140px; }
.orders-table .col-actions { width: 110px; }

.orders-table th {
  padding: 12px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.order-total-head {
  text-align: left;
}

.orders-table td {
  padding: 12px 10px;
  font-size: 0.88rem;
  line-height: 1.3;
  vertical-align: top;
  white-space: normal;
}

.orders-table tbody tr { height: auto; }

.order-summary-row td {
  border-bottom: 0;
  padding-bottom: 8px;
}

.order-detail-row td {
  padding-top: 0;
}

.order-number-cell,
.order-recipient-cell,
.order-phone-cell,
.order-tracking-cell,
.order-total-cell,
.order-created-cell,
.action-cell {
  color: var(--text);
}

.order-number-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-number-cell {
  font-weight: 700;
  padding-right: 18px;
}

.order-recipient-cell,
.order-phone-cell,
.order-tracking-cell,
.order-total-cell,
.order-created-cell,
.action-cell {
  padding-top: 14px;
}

.order-recipient-cell,
.order-phone-cell,
.order-tracking-cell {
  word-break: break-word;
}

.order-total-cell {
  text-align: left;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden;
  padding-left: 18px;
}

.order-created-cell {
  text-align: left;
  overflow: hidden;
  padding-right: 18px;
}

.order-total-text,
.order-created-text {
  display: block;
  white-space: nowrap;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.order-total-text {
  font-weight: inherit;
  min-width: 0;
  text-align: left;
  color: var(--muted);
}

.order-created-text {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.01em;
  font-size: 0.78rem;
  white-space: nowrap;
}

.order-detail-cell {
  padding: 0 10px 14px !important;
}

.order-lines-wrap {
  width: 90%;
  margin-left: auto;
}

.order-lines-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid rgba(33, 28, 24, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  table-layout: fixed;
}

.order-lines-table .col-thumb { width: 84px; }
.order-lines-table .col-name { width: auto; }
.order-lines-table .col-sku { width: 160px; }
.order-lines-table .col-qty { width: 90px; }
.order-lines-table .col-unit { width: 140px; }
.order-lines-table .col-total { width: 140px; }

.order-lines-table thead th {
  padding: 10px 14px;
  background: rgba(22, 75, 66, 0.06);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: left;
}

.order-lines-table thead th:nth-child(4),
.order-lines-table thead th:nth-child(5),
.order-lines-table thead th:nth-child(6) {
  text-align: right;
}

.order-lines-table tbody td {
  padding: 12px 14px;
  border-top: 1px solid rgba(33, 28, 24, 0.08);
  background: rgba(255, 255, 255, 0.72);
  vertical-align: middle;
}

.order-line-thumb-cell {
  padding-right: 0 !important;
}

.order-line-thumb {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(33, 28, 24, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.order-line-name-cell {
  min-width: 0;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
  font-weight: 600;
}

.order-line-sku-cell {
  color: var(--muted);
  font-size: 0.82rem;
  word-break: break-all;
}

.order-line-sku-cell,
.order-line-qty-cell,
.order-line-unit-cell,
.order-line-total-cell {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.order-line-qty-cell,
.order-line-unit-cell,
.order-line-total-cell {
  text-align: right;
}

.order-line-total-cell {
  color: var(--text);
  font-weight: 700;
}

.order-phone-cell,
.order-created-cell {
  color: var(--muted);
}

.order-tracking-cell {
  color: var(--muted);
}

.action-cell {
  white-space: nowrap;
  text-align: right;
}

.orders-empty-cell {
  padding: 26px 8px !important;
  text-align: center;
  color: var(--muted);
}

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

.section-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pagination-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.pagination-jump input[type="number"] {
  width: 78px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
}

.button.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.product-image-state {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1.1;
  white-space: nowrap;
}

.product-image-state.ready {
  color: #1b6b37;
  background: rgba(27, 107, 55, 0.12);
}

.product-image-state.missing {
  color: #9a4a14;
  background: rgba(217, 108, 43, 0.14);
}

.floating-notices {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 70;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.floating-note {
  margin: 0;
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  justify-content: space-between;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(25, 18, 14, 0.16);
}

.floating-note[hidden] {
  display: none !important;
}

.floating-note-body {
  min-width: 0;
  flex: 1 1 auto;
}

.floating-note-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.floating-note-actions {
  margin-top: 8px;
}

.floating-note-copy {
  padding-inline: 10px;
}

.floating-note-list[hidden] {
  display: none !important;
}

.floating-note-list li + li {
  margin-top: 4px;
}

.floating-note-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(29, 27, 25, 0.08);
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.floating-note-close:hover {
  background: rgba(29, 27, 25, 0.14);
  color: var(--text);
}

.floating-action-dock {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  width: min(430px, calc(100vw - 32px));
}

.floating-action-dock form {
  margin: 0;
}

.floating-action-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 250, 244, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 48px rgba(25, 18, 14, 0.18);
}

.floating-action-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.floating-action-copy strong {
  font-size: 0.92rem;
}

.floating-action-copy span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.product-filter-form {
  margin: 12px 0 16px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(6, minmax(140px, 0.8fr));
  gap: 10px;
  margin-bottom: 10px;
}

.filter-bar input,
.filter-bar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
}

.filter-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.import-layout {
  display: grid;
  gap: 18px;
}

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

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

.import-result.matched {
  color: var(--brand);
}

.import-result.created {
  color: #1b6b37;
}

.import-result.skipped {
  color: var(--muted);
}

.import-result.failed {
  color: #b42d16;
}

.import-path {
  word-break: break-all;
  color: var(--muted);
  font-size: 0.9rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check input {
  width: auto;
  margin: 0;
}

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

@media (max-width: 960px) {
  .hero, .detail, .cart-layout, .admin-grid, .metrics {
    grid-template-columns: 1fr;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .order-lines-wrap {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 18px, 1180px);
  }

  .topbar {
    padding: 14px;
    border-radius: 20px;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero > div, .hero-card, .panel, .note, .summary, .empty-state, .success {
    border-radius: 22px;
    padding: 20px;
  }

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

  .image-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .cart-item {
    grid-template-columns: 64px 1fr;
  }

  .cart-item strong {
    grid-column: 2;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .floating-notices {
    top: 12px;
    right: 12px;
    width: min(420px, calc(100vw - 24px));
  }

  .floating-action-dock {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
  }

  .floating-action-content {
    flex-direction: column;
    align-items: stretch;
  }

  .mobile-preview-dialog {
    padding: 18px;
  }

  .manifest-import-frame {
    min-height: 58vh;
    height: calc(88vh - 150px);
  }

  .mobile-preview-phone {
    width: min(100%, 360px);
  }

  .import-summary {
    grid-template-columns: 1fr 1fr;
  }

  .payment-card-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    bottom: 8px;
    width: calc(100% - 16px);
  }
}
