:root {
  color-scheme: dark;
  --bg: #080706;
  --panel: #12100e;
  --panel-strong: #1b1713;
  --line: #34271f;
  --text: #fff8ef;
  --muted: #c7b9aa;
  --orange: #ff7a1a;
  --orange-strong: #ff9a3d;
  --danger: #ff4f4f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 122, 26, 0.18), transparent 32rem),
    linear-gradient(135deg, #080706 0%, #15100c 58%, #0b0908 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 1.25rem;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.ghost-logo,
.mini-ghost {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 46px;
  border-radius: 50% 50% 14px 14px;
  background: #fff7ef;
  box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.16);
}

.ghost-logo::after,
.mini-ghost::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 10px;
  background: radial-gradient(circle at 6px 0, transparent 8px, #fff7ef 9px);
  content: "";
}

.ghost-eye {
  position: absolute;
  top: 17px;
  width: 7px;
  height: 9px;
  border-radius: 50%;
  background: #16110d;
}

.ghost-eye.left {
  left: 12px;
}

.ghost-eye.right {
  right: 12px;
}

.ghost-mouth {
  position: absolute;
  top: 29px;
  left: 18px;
  width: 7px;
  height: 4px;
  border-radius: 0 0 8px 8px;
  background: #ff7a1a;
}

.nav-actions {
  display: flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 16, 14, 0.82);
}

.nav-button,
.ghost-button,
.primary-button,
.whatsapp-button,
.small-action {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.nav-button {
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
}

.cart-toggle span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(255, 122, 26, 0.2);
  color: var(--orange-strong);
  font-size: 0.8rem;
}

.nav-button.active,
.primary-button,
.whatsapp-button {
  background: linear-gradient(135deg, var(--orange), var(--orange-strong));
  color: #140b04;
}

.catalog-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.75fr);
  align-items: center;
  min-height: 360px;
  gap: 36px;
  padding: 42px 0 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--orange-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.35rem, 8vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-copy,
.panel-copy {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.mascot-stage {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 122, 26, 0.12), transparent 44%),
    #11100f;
  box-shadow: var(--shadow);
}

.moon {
  position: absolute;
  top: 42px;
  right: 44px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #ffb35e;
  box-shadow: 0 0 46px rgba(255, 122, 26, 0.52);
}

.big-ghost {
  position: absolute;
  top: 78px;
  left: 50%;
  width: 170px;
  height: 190px;
  transform: translateX(-50%);
  border-radius: 50% 50% 24px 24px;
  background: #fff8ef;
  animation: float 4s ease-in-out infinite;
}

.big-ghost::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 34px;
  background: radial-gradient(circle at 17px 0, transparent 23px, #fff8ef 24px);
  content: "";
}

.big-ghost span {
  position: absolute;
  top: 74px;
  z-index: 1;
  width: 20px;
  height: 28px;
  border-radius: 50%;
  background: #15100c;
}

.big-ghost span:first-child {
  left: 48px;
}

.big-ghost span:nth-child(2) {
  right: 48px;
}

.big-ghost i {
  position: absolute;
  top: 112px;
  left: 73px;
  z-index: 1;
  width: 24px;
  height: 14px;
  border-radius: 0 0 18px 18px;
  background: var(--orange);
}

@keyframes float {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -14px);
  }
}

.catalog-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 14px 0 22px;
}

.stack-form label,
.product-form label,
.category-form label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e0c0b;
  color: var(--text);
  outline: none;
  padding: 13px 14px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.16);
}

.product-count {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

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

.category-section {
  display: grid;
  gap: 14px;
}

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 122, 26, 0.22);
}

.category-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.category-heading span {
  color: var(--muted);
  font-weight: 700;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 16, 14, 0.92);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

.product-image-wrap {
  aspect-ratio: 4 / 3;
  background: #211710;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.product-info h2,
.category-panel h2,
.product-form h2,
.table-title h2 {
  margin: 0;
  font-size: 1.08rem;
}

.category-pill {
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(255, 122, 26, 0.34);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--orange-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.product-info p {
  min-height: 3.1em;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.product-info strong {
  color: var(--orange-strong);
  font-size: 1.2rem;
}

.buy-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.buy-row label {
  display: grid;
  gap: 6px;
}

.buy-row input {
  min-height: 42px;
  padding: 9px 10px;
}

.whatsapp-button {
  width: 100%;
  padding: 0 12px;
}

.empty-state,
.login-panel,
.settings-panel,
.category-panel,
.product-form,
.product-table-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 16, 14, 0.92);
  box-shadow: var(--shadow);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 22px;
  text-align: center;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.mini-ghost {
  width: 50px;
  height: 54px;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 0.55fr);
  gap: 30px;
  margin: 64px auto 0;
  padding: 28px;
}

.stack-form,
.product-form {
  display: grid;
  gap: 16px;
}

.form-message {
  min-height: 1.4em;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 0 20px;
}

.admin-header h1 {
  font-size: clamp(2rem, 6vw, 4rem);
}

.ghost-button {
  padding: 0 16px;
  border-color: var(--line);
  background: #14110f;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 20px;
}

.admin-column {
  display: grid;
  gap: 20px;
}

.settings-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 0.7fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
  padding: 18px;
}

.settings-panel label {
  display: grid;
  gap: 8px;
}

.settings-message {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.product-form,
.category-panel,
.product-table-shell {
  padding: 18px;
}

.category-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.category-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

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

.category-item strong,
.category-item span {
  overflow-wrap: anywhere;
}

.category-item span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.preview-box {
  display: grid;
  place-items: center;
  min-height: 180px;
  overflow: hidden;
  border: 1px dashed #594031;
  border-radius: 8px;
  background: #0e0c0b;
  color: var(--muted);
}

.preview-box img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.table-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.table-title span {
  color: var(--muted);
  font-weight: 700;
}

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

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

.admin-item img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: #211710;
}

.admin-item h3,
.admin-item p {
  margin: 0;
}

.admin-item p {
  color: var(--muted);
}

.item-actions {
  display: flex;
  gap: 8px;
}

.small-action {
  min-width: 42px;
  padding: 0 12px;
  border-color: var(--line);
  background: #171310;
}

.small-action.danger {
  border-color: rgba(255, 79, 79, 0.45);
  color: #ffd5d5;
}

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.56);
}

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(420px, 100%);
  border-left: 1px solid var(--line);
  background: #100e0c;
  box-shadow: -26px 0 70px rgba(0, 0, 0, 0.46);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.cart-header h2 {
  margin: 0;
}

.cart-items {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 16px;
}

.cart-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171310;
}

.cart-item h3,
.cart-item p,
.empty-cart p {
  margin: 0;
}

.cart-item p {
  color: var(--muted);
  font-weight: 700;
}

.cart-controls {
  display: grid;
  grid-template-columns: 42px 42px 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.cart-controls span {
  display: grid;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 800;
}

.empty-cart {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 32px 20px;
  color: var(--muted);
  text-align: center;
}

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

.cart-footer strong {
  color: var(--orange-strong);
  font-size: 1.1rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .catalog-hero,
  .login-panel,
  .settings-panel,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .catalog-hero {
    min-height: auto;
    padding-top: 24px;
  }

  .mascot-stage {
    min-height: 260px;
  }

  .catalog-toolbar,
  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .item-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 8px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

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

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

  .cart-controls {
    grid-template-columns: 42px 42px 42px;
  }

  .cart-controls .danger {
    grid-column: 1 / -1;
  }
}
