:root {
  --bg: #f5f7fb;
  --surface: rgba(255, 255, 255, 0.94);
  --text: #162033;
  --muted: #667085;
  --line: #d9e0ea;
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --action: #ffd814;
  --action-hover: #f7ca00;
  --action-border: #f0b800;
  --action-text: #111827;
  --danger: #d32f2f;
  --body-overlay: rgba(245, 247, 251, 0.78);
  --input-bg: #fff;
  --card-border: rgba(83, 76, 76, 0.74);
  --card-bg:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(218, 225, 235, 0.92)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.38), rgba(126, 140, 158, 0.16));
  --card-hover-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(116, 129, 146, 0.16),
    0 16px 34px rgba(16, 24, 40, 0.18),
    0 0 0 1px rgba(21, 101, 192, 0.08);
  --login-bg:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(208, 216, 226, 0.94)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.4), rgba(141, 154, 171, 0.2));
  --secondary-bg: linear-gradient(180deg, #ffffff 0%, #edf2f8 100%);
  --secondary-bg-hover: linear-gradient(180deg, #f8fbff 0%, #dfe7f1 100%);
  --secondary-border: #c7d0dd;
  --secondary-border-hover: #aeb9c8;
  --secondary-text: #162033;
}

body.dark-mode {
  --bg: #0f172a;
  --surface: rgba(15, 23, 42, 0.94);
  --text: #e5edf8;
  --muted: #aab7ca;
  --line: #334155;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --action: #facc15;
  --action-hover: #eab308;
  --action-border: #ca8a04;
  --action-text: #111827;
  --danger: #ef4444;
  --body-overlay: rgba(15, 23, 42, 0.8);
  --input-bg: #111827;
  --card-border: rgba(45, 212, 191, 0.26);
  --card-bg:
    radial-gradient(circle at 12% 0%, rgba(45, 212, 191, 0.18), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(96, 165, 250, 0.16), transparent 30%),
    linear-gradient(145deg, rgba(24, 35, 58, 0.98) 0%, rgba(13, 25, 44, 0.97) 52%, rgba(8, 18, 32, 0.98) 100%);
  --card-hover-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(15, 23, 42, 0.42),
    0 18px 38px rgba(0, 0, 0, 0.34),
    0 0 26px rgba(45, 212, 191, 0.18),
    0 0 0 1px rgba(96, 165, 250, 0.18);
  --login-bg:
    radial-gradient(circle at 15% 0%, rgba(45, 212, 191, 0.2), transparent 36%),
    radial-gradient(circle at 88% 18%, rgba(96, 165, 250, 0.14), transparent 32%),
    linear-gradient(145deg, rgba(24, 35, 58, 0.98) 0%, rgba(13, 25, 44, 0.97) 56%, rgba(8, 18, 32, 0.98) 100%);
  --secondary-bg: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  --secondary-bg-hover: linear-gradient(180deg, #475569 0%, #263449 100%);
  --secondary-border: #64748b;
  --secondary-border-hover: #94a3b8;
  --secondary-text: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--body-overlay);
}

.login-gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  padding: 26px;
  background: var(--login-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(116, 129, 146, 0.22),
    0 18px 48px rgba(24, 34, 48, 0.2);
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-bottom: 18px;
  text-align: center;
}

.login-brand h1 {
  margin: 0;
}

.register-panel {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.auth-panel-card {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.register-panel form {
  gap: 11px;
}

.auth-panel-card form {
  gap: 11px;
}

.login-card h2 {
  margin: 0;
}

.link-button {
  border: 0;
  padding: 4px 8px;
  color: var(--primary);
  background: transparent;
  box-shadow: none;
}

.link-button:hover {
  color: var(--primary-dark);
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 10px 18px;
  border-bottom: 3px solid #f3a847;
  color: #fff;
  background: linear-gradient(180deg, #232f3e 0%, #151e29 100%);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 230px;
  min-width: 150px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
}

nav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.topbar-search {
  position: relative;
  display: grid;
  grid-template-columns: 44px 0fr;
  align-items: center;
  flex: 0 1 auto;
  min-width: 44px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  transition:
    grid-template-columns 0.22s ease,
    flex-basis 0.22s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.topbar-search.open {
  grid-template-columns: 44px minmax(180px, 320px);
  border-color: rgba(243, 168, 71, 0.72);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

body.dark-mode .topbar-search.open {
  background: rgba(15, 23, 42, 0.98);
}

button {
  border: 1px solid var(--action-border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--action-text);
  background: linear-gradient(180deg, #ffe768 0%, var(--action) 54%, #f5c400 100%);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.15;
  box-shadow:
    0 2px 5px rgba(17, 24, 39, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.48);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}

button:hover {
  border-color: #d5a500;
  background: linear-gradient(180deg, #ffe15a 0%, var(--action-hover) 58%, #edbd00 100%);
  box-shadow:
    0 4px 10px rgba(17, 24, 39, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

button:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 3px rgba(17, 24, 39, 0.16),
    inset 0 2px 5px rgba(138, 103, 0, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

button.secondary {
  color: var(--secondary-text);
  border-color: var(--secondary-border);
  background: var(--secondary-bg);
}

button.secondary:hover {
  border-color: var(--secondary-border-hover);
  background: var(--secondary-bg-hover);
}

.nav-btn {
  position: relative;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #f8fafc;
  background: transparent;
  box-shadow: none;
}

.nav-btn.has-notification {
  border-color: rgba(239, 68, 68, 0.9);
  color: #fff;
  background:
    radial-gradient(circle at 85% 18%, rgba(255, 255, 255, 0.34), transparent 18px),
    linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  box-shadow:
    0 0 0 3px rgba(239, 68, 68, 0.18),
    0 8px 20px rgba(127, 29, 29, 0.26);
}

.nav-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #ef4444;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.nav-btn:hover,
.nav-btn.active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.mobile-more-btn {
  position: relative;
  display: none;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #f8fafc;
  background: transparent;
  box-shadow: none;
}

.session {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #fff;
}

.user-menu {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.theme-toggle:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.theme-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: linear-gradient(90deg, #fff 0 50%, #111827 50% 100%);
}

.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border: 1px solid #111827;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

body.dark-mode .theme-toggle-thumb {
  border-color: #fff;
  background: #111827;
  transform: translateX(16px);
}

.profile-link {
  border: 0;
  padding: 0;
  color: #f3a847;
  background: transparent;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 2px;
  box-shadow: none;
}

.profile-link:hover {
  border-color: transparent;
  color: #fff;
  background: transparent;
  box-shadow: none;
}

.cart-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  padding: 8px 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.cart-button:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.cart-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.cart-button #cartIconFull {
  fill: #f3a847;
}

.cart-button strong {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  color: #111827;
  background: #f3a847;
  font-size: 13px;
}

main {
  width: min(1180px, calc(100% - 28px));
  margin: 24px auto 48px;
}

.auth-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.panel,
.card,
.order-card {
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 18px;
  background: var(--card-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px 0 rgba(116, 129, 146, 0.18),
    0 10px 28px rgba(16, 24, 40, 0.12);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease,
    transform 0.18s ease;
}

body.dark-mode .panel,
body.dark-mode .card,
body.dark-mode .order-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -1px 0 rgba(2, 6, 23, 0.48),
    0 12px 30px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(15, 118, 110, 0.08);
}

.panel:hover,
.card:hover,
.order-card:hover {
  border-color: rgba(96, 165, 250, 0.42);
  box-shadow: var(--card-hover-shadow);
  filter: brightness(1.025);
  transform: translateY(-2px);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.section-heading {
  margin: 16px 0;
}

.section-heading h1 {
  margin: 0 0 6px;
  font-size: 32px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

select {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

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

.products-grid {
  align-items: stretch;
}

.product-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 280px);
  gap: 12px;
  align-items: center;
  justify-content: end;
  margin: 0 0 16px;
}

.question-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 240px);
  justify-content: end;
  margin: 0 0 16px;
}

.search-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  color: #fff;
  background: transparent;
  box-shadow: none;
}

.search-toggle:hover,
.search-toggle.active {
  color: #111827;
  background: #f3a847;
  box-shadow: none;
}

.search-toggle span {
  line-height: 1;
}

.topbar-search.open .search-toggle {
  color: #111827;
}

.search-box {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
}

.search-box span {
  position: absolute;
  top: 50%;
  left: 13px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  height: 42px;
  min-width: 0;
  border: 0;
  border-radius: 0 999px 999px 0;
  padding-left: 40px;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.admin-only.panel {
  width: min(420px, 100%);
  margin-bottom: 14px;
}

.profile-panel {
  width: min(460px, 100%);
  margin: 0 auto;
}

#profile {
  text-align: center;
}

#profile .section-heading {
  width: min(560px, 100%);
  margin-right: auto;
  margin-left: auto;
}

#profile label {
  text-align: left;
}

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

.admin-tool-card {
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 8px 22px rgba(16, 24, 40, 0.1);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease,
    transform 0.18s ease;
}

body.dark-mode .admin-tool-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -1px 0 rgba(2, 6, 23, 0.48),
    0 12px 30px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(15, 118, 110, 0.08);
}

.admin-tool-card:hover {
  border-color: rgba(96, 165, 250, 0.42);
  box-shadow: var(--card-hover-shadow);
  filter: brightness(1.025);
  transform: translateY(-2px);
}

.admin-tool-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  color: var(--text);
  text-align: left;
  background: transparent;
  box-shadow: none;
}

.admin-tool-trigger:hover {
  color: #fff;
  border-color: transparent;
  background: var(--primary);
  box-shadow: none;
}

.admin-tool-trigger strong,
.admin-tool-trigger small {
  display: block;
}

.admin-tool-trigger small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.admin-tool-trigger:hover small {
  color: rgba(255, 255, 255, 0.82);
}

.chevron {
  font-size: 18px;
  transition: transform 0.18s ease;
}

.admin-tool-card.open .chevron {
  transform: rotate(180deg);
}

.admin-tool-body {
  display: grid;
  max-height: 0;
  gap: 10px;
  padding: 0 14px;
  overflow: hidden;
  border-top: 1px solid transparent;
  transition: max-height 0.22s ease, padding 0.22s ease, border-color 0.22s ease;
}

.admin-tool-card.open .admin-tool-body {
  max-height: 420px;
  padding: 12px 14px 14px;
  border-top-color: rgba(83, 76, 76, 0.18);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card {
  cursor: pointer;
}

.product-card.open {
  border-color: rgba(243, 168, 71, 0.62);
}

.trash-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #fff;
  background: rgba(211, 47, 47, 0.92);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

body.is-admin .trash-btn {
  display: grid;
  place-items: center;
}

.trash-btn:hover,
.danger-btn:hover {
  border-color: #8f1b1b;
  color: #fff;
  background: #a91f1f;
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #e8edf5;
}

.content-image {
  display: block;
  max-width: 100%;
  max-height: 320px;
  margin: 10px auto 0;
  object-fit: contain;
}

.price-old {
  color: var(--muted);
  text-decoration: line-through;
}

.price-new {
  font-size: 24px;
  font-weight: 800;
}

.discount {
  display: inline-block;
  width: fit-content;
  border-radius: 4px;
  padding: 5px 8px;
  color: #fff;
  background: var(--danger);
  font-weight: 800;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(21, 101, 192, 0.18);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--primary-dark);
  background: rgba(21, 101, 192, 0.08);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

body.dark-mode .category-chip {
  border-color: rgba(96, 165, 250, 0.28);
  color: #bfdbfe;
  background: rgba(96, 165, 250, 0.14);
}

.stock-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 999px;
  padding: 5px 10px;
  color: #047857;
  background: rgba(16, 185, 129, 0.1);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.rating-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.rating-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.rating-summary.large {
  margin-top: 6px;
}

.rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  line-height: 1;
}

.rating-star {
  padding: 0;
  border: 0;
  color: #a8b1c1;
  background: transparent;
  box-shadow: none;
  font-size: 17px;
}

.rating-star.active {
  color: #f3a847;
}

button.rating-star {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 22px;
}

button.rating-star:hover {
  color: #111827;
  background: #f3a847;
  box-shadow: none;
}

.product-detail {
  display: none;
  border: 1px solid rgba(21, 101, 192, 0.12);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(21, 101, 192, 0.06), rgba(243, 168, 71, 0.06)),
    rgba(255, 255, 255, 0.34);
}

.product-card.open .product-detail {
  display: grid;
  gap: 10px;
}

.product-detail h4,
.product-detail p {
  margin: 0;
}

.product-detail p {
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.extra-info-content a {
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.extra-info-content a:hover {
  color: var(--primary);
}

body.dark-mode .extra-info-content a {
  color: #93c5fd;
}

.rating-detail {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.question-compose {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ask-btn {
  width: 100%;
  border-color: #0f766e;
  color: #f8fafc;
  background: linear-gradient(180deg, #14b8a6 0%, #0f766e 100%);
}

.ask-btn:hover {
  border-color: #115e59;
  color: #fff;
  background: linear-gradient(180deg, #2dd4bf 0%, #0f766e 100%);
}

.rating-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rating-picker > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

body.dark-mode .product-detail {
  border-color: rgba(45, 212, 191, 0.2);
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.1), rgba(96, 165, 250, 0.08)),
    rgba(2, 6, 23, 0.22);
}

body.dark-mode .rating-star {
  color: #64748b;
}

body.dark-mode .rating-star.active {
  color: #fbbf24;
}

.stock-chip.out-of-stock {
  border-color: rgba(211, 47, 47, 0.24);
  color: var(--danger);
  background: rgba(211, 47, 47, 0.1);
}

body.dark-mode .stock-chip {
  border-color: rgba(45, 212, 191, 0.26);
  color: #99f6e4;
  background: rgba(45, 212, 191, 0.12);
}

body.dark-mode .stock-chip.out-of-stock {
  border-color: rgba(248, 113, 113, 0.3);
  color: #fecaca;
  background: rgba(248, 113, 113, 0.12);
}

.category-admin-list {
  display: grid;
  gap: 8px;
}

.category-admin-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.34);
}

body.dark-mode .category-admin-item {
  border-color: rgba(45, 212, 191, 0.18);
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(96, 165, 250, 0.07)),
    rgba(15, 23, 42, 0.38);
}

.category-admin-item strong,
.category-admin-item small {
  display: block;
}

.category-admin-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.category-admin-item .danger-btn {
  margin-top: 0;
  padding: 8px 11px;
  font-size: 12px;
}

.product-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.add-cart-btn {
  width: 100%;
}

.danger-btn {
  margin-top: 8px;
  border-color: #a91f1f;
  color: #fff;
  background: linear-gradient(180deg, #ef5350 0%, var(--danger) 100%);
}

.admin-actions {
  display: none;
  gap: 8px;
  margin-top: 0;
}

body.is-admin .admin-actions {
  display: flex;
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr 96px 92px;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cashback-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.cashback-toggle {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
}

.cashback-toggle input {
  width: auto;
}

.cashback-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.cashback-preview {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.cashback-preview strong {
  color: #047857;
  font-size: 22px;
}

body.dark-mode .cashback-preview strong {
  color: #99f6e4;
}

.order-card ul {
  padding-left: 18px;
}

.order-payment-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 8px 0 4px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.34);
}

body.dark-mode .order-payment-box {
  background: rgba(15, 23, 42, 0.48);
}

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

.payment-check input {
  width: 18px;
  height: 18px;
  accent-color: #047857;
}

.payment-receipt-preview {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.payment-receipt-preview img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.payment-receipt-link {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.order-date {
  margin-top: -4px;
  color: var(--muted);
  font-size: 13px;
}

.orders-loading {
  margin: 14px 0 0;
  text-align: center;
}

.orders-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  margin: 0 0 16px;
}

.orders-toolbar label {
  min-width: min(260px, 100%);
}

.orders-toolbar .export-panel {
  margin: 0;
}

.monthly-sales-panel {
  justify-content: flex-start;
}

.questions-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}

.question-ticket {
  position: relative;
  display: grid;
  gap: 12px;
  cursor: pointer;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 18px;
  background: var(--card-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px 0 rgba(116, 129, 146, 0.18),
    0 10px 28px rgba(16, 24, 40, 0.12);
}

.question-ticket.open {
  border-color: rgba(243, 168, 71, 0.62);
}

.close-ticket-btn {
  width: 100%;
  margin-top: 0;
  padding: 10px 16px;
  border-color: #a91f1f;
  color: #f8fafc;
  background: linear-gradient(180deg, #ef5350 0%, var(--danger) 100%);
  font-size: 14px;
}

.close-ticket-btn:hover {
  border-color: #8f1b1b;
  color: #fff;
  background: #a91f1f;
}

.ticket-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.ticket-action-row .ask-btn,
.ticket-action-row .close-ticket-btn {
  width: 190px;
  min-width: 150px;
  max-width: 100%;
}

.ticket-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  padding-right: 0;
}

.question-ticket .trash-btn ~ .ticket-head {
  padding-right: 42px;
}

.ticket-head h3 {
  margin: 2px 0 0;
}

.ticket-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.turn-chip {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(21, 101, 192, 0.2);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--primary-dark);
  background: rgba(21, 101, 192, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.turn-chip.turn-active {
  border-color: rgba(15, 118, 110, 0.28);
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}

.product-link-btn {
  justify-self: start;
  max-width: 100%;
  border-color: var(--secondary-border);
  color: var(--secondary-text);
  text-align: left;
  background: var(--secondary-bg);
  white-space: normal;
}

.question-original,
.ticket-message {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.36);
}

.question-summary {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  text-align: justify;
}

.ticket-expanded {
  display: none;
  gap: 12px;
}

.question-ticket.open .ticket-expanded {
  display: grid;
}

.question-original p,
.ticket-message p {
  margin: 0;
  line-height: 1.45;
  text-align: justify;
  white-space: pre-wrap;
}

.ticket-thread {
  display: grid;
  gap: 10px;
}

.ticket-message.from-admin {
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(16, 185, 129, 0.1);
}

.ticket-message small {
  color: var(--muted);
  font-size: 12px;
}

.ticket-reply-form {
  padding-top: 4px;
}

.order-card {
  position: relative;
}

.order-trash {
  display: grid;
  place-items: center;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 18px 0 0;
}

.pagination-summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.pagination-buttons button {
  min-width: 42px;
  padding: 8px 11px;
  font-size: 13px;
}

.pagination-buttons .page-number.active {
  border-color: rgba(243, 168, 71, 0.7);
  color: #111827;
  background: #f3a847;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  border-radius: 8px;
  padding: 14px 16px;
  color: #fff;
  background: #263238;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.primary {
  margin-top: 14px;
}

.points-rate-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.export-panel {
  position: relative;
  display: flex;
  justify-content: flex-end;
  margin: 0 0 14px;
}

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  display: grid;
  min-width: 180px;
  gap: 8px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.18);
}

.export-menu button {
  width: 100%;
}

.points-rate-panel label {
  min-width: 220px;
}

.buyers-table-panel {
  padding: 0;
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.buyers-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.36);
  font-size: 14px;
}

.buyers-table th,
.buyers-table td {
  border: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
}

.buyers-table th {
  position: sticky;
  top: 0;
  color: #fff;
  background: var(--primary-dark);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.buyers-table tbody tr:nth-child(even) {
  background: rgba(21, 101, 192, 0.05);
}

.buyers-table tbody tr:hover {
  background: rgba(243, 168, 71, 0.12);
}

.buyer-delete-btn {
  margin-top: 0;
  padding: 8px 11px;
  white-space: nowrap;
}

body.dark-mode .buyers-table {
  background: rgba(2, 6, 23, 0.18);
}

body.dark-mode .buyers-table th {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(30, 64, 175, 0.86));
}

body.dark-mode .buyers-table tbody tr:nth-child(even) {
  background: rgba(45, 212, 191, 0.06);
}

body.dark-mode .buyers-table tbody tr:hover {
  background: rgba(96, 165, 250, 0.1);
}

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

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

@media (max-width: 760px) {
  body {
    padding-bottom: 92px;
    background-attachment: scroll;
  }

  .topbar {
    position: sticky;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand brand brand"
      "user cart logout";
    align-items: center;
    column-gap: 8px;
    row-gap: 8px;
    min-height: auto;
    padding: 10px 10px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
  }

  .topbar.search-open {
    grid-template-areas:
      "brand brand brand"
      "search search search"
      "user cart logout";
  }

  .brand {
    grid-area: brand;
    flex: initial;
    min-width: 0;
    gap: 8px;
    justify-content: center;
    font-size: clamp(16px, 4.2vw, 20px);
    line-height: 1.05;
  }

  .brand-logo {
    width: clamp(34px, 9vw, 40px);
    height: clamp(34px, 9vw, 40px);
    flex: 0 0 auto;
  }

  #brandName {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  nav {
    position: fixed;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: center;
    gap: 6px;
    width: auto;
    max-width: 560px;
    margin: 0 auto;
    padding: 8px;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: rgba(17, 24, 39, 0.96);
    box-shadow:
      0 16px 36px rgba(0, 0, 0, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    scrollbar-width: none;
  }

  body.is-admin nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .topbar-search {
    grid-area: user;
    justify-self: start;
    width: 44px;
  }

  .topbar-search.open {
    grid-area: search;
    grid-template-columns: 44px minmax(0, 1fr);
    width: 100%;
  }

  .nav-btn {
    min-width: 0;
    min-height: 52px;
    padding: 8px 6px;
    border-radius: 14px;
    color: #dbe4ef;
    font-size: 12px;
    line-height: 1.15;
    white-space: normal;
    background: transparent;
    box-shadow: none;
  }

  body.is-admin .mobile-more-btn {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 52px;
    padding: 8px 6px;
    border-radius: 14px;
    color: #dbe4ef;
    font-size: 12px;
    line-height: 1.15;
    white-space: normal;
    background: transparent;
    box-shadow: none;
  }

  body.is-admin .mobile-more-btn::before {
    content: "...";
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
  }

  body.is-admin.mobile-more-open .mobile-more-btn {
    border-color: rgba(243, 168, 71, 0.7);
    color: #111827;
    background: #f3a847;
  }

  body.is-admin .mobile-more-btn.has-notification {
    border-color: rgba(239, 68, 68, 0.9);
    color: #fff;
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
  }

  .nav-btn::before {
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
    line-height: 1;
  }

  .nav-btn[data-section="home"]::before {
    content: "⌂";
  }

  .nav-btn[data-section="products"]::before {
    content: "▦";
  }

  .nav-btn[data-section="myOrders"]::before,
  .nav-btn[data-section="activeOrders"]::before {
    content: "≡";
  }

  .nav-btn[data-section="attendedOrders"]::before {
    content: "✓";
  }

  .nav-btn[data-section="questions"]::before {
    content: "?";
  }

  .nav-btn.active {
    border-color: rgba(243, 168, 71, 0.7);
    color: #111827;
    background: #f3a847;
    box-shadow: 0 6px 16px rgba(243, 168, 71, 0.24);
  }

  .nav-btn[data-section="myOrders"] span,
  .nav-btn[data-section="activeOrders"] span,
  .nav-btn[data-section="attendedOrders"] span {
    display: none;
  }

  .nav-btn[data-section="myOrders"]::after {
    content: "Mis pedidos";
  }

  .nav-btn[data-section="activeOrders"]::after {
    content: "Activos";
  }

  .nav-btn[data-section="attendedOrders"]::after {
    content: "Atendidos";
  }

  .nav-btn[data-section="buyersSummary"] span {
    display: none;
  }

  .nav-btn[data-section="buyersSummary"]::before {
    content: "$";
  }

  .nav-btn[data-section="buyersSummary"]::after {
    content: "Clientes";
  }

  body.is-admin .nav-btn[data-section="questions"],
  body.is-admin .nav-btn[data-section="buyersSummary"] {
    position: fixed;
    right: 18px;
    left: auto;
    z-index: 19;
    display: none;
    width: min(220px, calc(100vw - 36px));
    min-height: 46px;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #f8fafc;
    background: rgba(17, 24, 39, 0.98);
    box-shadow:
      0 14px 28px rgba(0, 0, 0, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  body.is-admin.mobile-more-open .nav-btn[data-section="questions"],
  body.is-admin.mobile-more-open .nav-btn[data-section="buyersSummary"] {
    display: block;
  }

  body.is-admin .nav-btn[data-section="buyersSummary"] {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  body.is-admin .nav-btn[data-section="questions"] {
    bottom: calc(130px + env(safe-area-inset-bottom));
  }

  .session {
    display: contents;
  }

  .user-menu {
    grid-area: user;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    justify-items: center;
    justify-self: start;
    gap: 1px;
  }

  .theme-toggle {
    grid-area: user;
    justify-self: start;
    width: 42px;
    height: 28px;
    margin-left: 48px;
  }

  .theme-toggle + .user-menu {
    margin-left: 96px;
    max-width: calc(100% - 96px);
  }

  .topbar.search-open .theme-toggle {
    margin-left: 0;
  }

  .topbar.search-open .theme-toggle + .user-menu {
    margin-left: 48px;
    max-width: calc(100% - 48px);
  }

  #userBadge {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(11px, 3.2vw, 12px);
    line-height: 1.2;
    padding-left: 2px;
    color: #dbe4ef;
  }

  .profile-link {
    font-size: 11px;
  }

  .cart-button {
    grid-area: cart;
    align-self: stretch;
    min-width: 52px;
    min-height: 42px;
    justify-content: center;
    padding: 7px 8px;
    border-color: transparent;
    background: rgba(243, 168, 71, 0.12);
  }

  .cart-button span {
    display: none;
  }

  .cart-button svg {
    width: 26px;
    height: 26px;
  }

  .cart-button strong {
    min-width: 20px;
    height: 20px;
    font-size: 12px;
  }

  #logoutBtn {
    grid-area: logout;
    align-self: stretch;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 12px;
  }

  main {
    width: min(100% - 20px, 560px);
    margin-top: 16px;
    margin-bottom: 28px;
  }

  .section-heading {
    margin: 14px 0;
  }

  .section-heading h1 {
    font-size: 26px;
  }

  .grid,
  .products-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .product-toolbar {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .question-toolbar {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

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

.panel,
.card,
.order-card {
    padding: 14px;
    border-radius: 12px;
  }

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

  .points-rate-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
  }

  .export-panel {
    justify-content: stretch;
  }

  .export-panel > button {
    width: 100%;
  }

  .export-menu {
    position: static;
    margin-top: 8px;
    width: 100%;
  }

  .points-rate-panel label {
    min-width: 0;
    font-size: 12px;
  }

  .points-rate-panel button {
    grid-column: 1 / -1;
  }

  .buyers-table {
    min-width: 0;
    font-size: 12px;
  }

  .buyers-table th,
  .buyers-table td {
    padding: 9px 7px;
    white-space: normal;
  }

  .buyers-table th:nth-child(2),
  .buyers-table td:nth-child(2),
  .buyers-table th:nth-child(3),
  .buyers-table td:nth-child(3) {
    display: none;
  }

  .questions-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .question-ticket {
    padding: 14px;
  }

  .ticket-head {
    padding-right: 0;
  }

  .close-ticket-btn {
    width: 100%;
  }

  .ticket-action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ticket-action-row .ask-btn,
  .ticket-action-row .close-ticket-btn {
    width: 100%;
    min-width: 0;
  }
}

.order-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
}

.order-card button:first-of-type {
  margin-top: auto;
}

@media (max-width: 440px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 7px;
  }

  .brand {
    justify-content: center;
  }

  #userBadge {
    max-width: 100%;
  }

  #logoutBtn {
    padding-inline: 12px;
  }

  .nav-btn {
    min-height: 50px;
    font-size: 11px;
  }

  body.is-admin .mobile-more-btn {
    min-height: 50px;
    font-size: 11px;
  }
}

@media (max-width: 380px) {
  nav {
    gap: 4px;
    padding: 6px;
  }

  .nav-btn {
    min-height: 46px;
    padding-inline: 3px;
    font-size: 10px;
  }

  .nav-btn::before {
    margin-bottom: 2px;
    font-size: 16px;
  }
}
