:root {
  color-scheme: light;
  --page: #eef2f4;
  --panel: #ffffff;
  --ink: #182026;
  --muted: #66727d;
  --line: #d9e0e5;
  --accent: #0f8f7a;
  --accent-dark: #0a6759;
  --hero: #12342f;
  --hero-text: #ffffff;
  --surface: #f8fafb;
  --danger: #b93b3b;
  --shadow: 0 18px 40px rgba(16, 31, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--hero) 92%, #000);
  padding: 20px;
}

.access-card {
  width: min(460px, 100%);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
  padding: 30px;
}

.access-card h1 {
  margin: 8px 0 20px;
  font-size: 34px;
}

.large-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
}

.access-actions,
.access-panel {
  display: grid;
  gap: 10px;
}

.bordered {
  border: 1px solid var(--line);
}

.danger-text {
  color: var(--danger);
}

#cepStatus {
  min-height: 18px;
}

.mode-gate .app-shell {
  filter: blur(2px);
  pointer-events: none;
}

.mode-customer .admin-tab:not([data-tab="customer"]),
.mode-catalog .admin-tab:not([data-tab="customer"]),
.mode-registration .admin-tab:not([data-tab="customer"]),
.mode-customer .actions,
.mode-catalog .actions,
.mode-registration .actions {
  display: none;
}

.mode-registration .order-flow,
.mode-registration .workspace,
.mode-customer .order-flow {
  display: none;
}

.mode-registration .app-shell {
  display: block;
}

.mode-registration .control-panel {
  width: min(560px, calc(100% - 28px));
  max-height: none;
  margin: 28px auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.mode-catalog .control-panel {
  display: none;
}

.mode-catalog .app-shell,
.mode-shopping .app-shell {
  grid-template-columns: 1fr;
}

.mode-catalog .workspace,
.mode-shopping .workspace {
  padding-top: 34px;
}

.mode-catalog .workspace-toolbar,
.mode-shopping .workspace > .workspace-toolbar,
.mode-shopping .catalog:not(.customer-shop),
.mode-shopping .control-panel {
  display: none;
}

.mode-shopping .shop-toolbar {
  display: grid;
}

.mode-catalog .workspace-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--page);
  padding: 0 0 14px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  min-height: 100vh;
}

.control-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px;
  overflow-y: auto;
  max-height: 100vh;
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.brand-block > div {
  flex: 1;
}

.active-user-badge {
  display: inline-flex;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 850;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 24px;
}

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

.admin-tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  min-height: 38px;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 800;
}

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

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-section {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.panel-section.first {
  border-top: 0;
  padding-top: 0;
}

.panel-section h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #33404a;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

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

.password-field input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 900;
}

.password-toggle:hover {
  background: var(--surface);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

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

.inline-check input {
  width: auto;
}

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

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

.product-form {
  display: grid;
  gap: 9px;
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.file-input {
  padding: 9px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 12px;
}

.segmented-option {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 9px;
  font-weight: 800;
}

.segmented-option.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(20, 40, 54, 0.08);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 12px;
  font-weight: 850;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

.danger-button {
  background: #fff5f5;
  border-color: #edc7c7;
  color: var(--danger);
}

.small-button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

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

.actions {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 9px;
  background: linear-gradient(to top, var(--panel) 82%, color-mix(in srgb, var(--panel) 0%, transparent));
  padding-top: 18px;
}

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

.manager-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.manager-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.manager-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.vertical-item {
  display: grid;
  align-items: stretch;
}

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sub-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.log-details {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.log-details span {
  color: var(--muted);
  font-size: 12px;
}

.sub-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 5px 7px;
  color: var(--ink) !important;
}

.sub-pill button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: #f0dada;
  color: var(--danger);
  padding: 0;
  font-weight: 900;
}

.empty-mini {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin: 12px 0;
  padding: 14px;
}

.cart-total span {
  color: var(--muted);
  font-weight: 800;
}

.cart-total strong {
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: 950;
}

.palette-grid {
  display: grid;
  gap: 10px;
}

.palette-card {
  display: grid;
  gap: 9px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--ink);
  text-align: left;
}

.palette-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.palette-name {
  font-weight: 850;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.swatches i {
  display: block;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.workspace {
  padding: 24px;
  overflow: auto;
}

.workspace-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 210px 210px auto;
  gap: 12px;
  align-items: center;
  margin: 0 auto 18px;
  max-width: 1120px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
  font-size: 13px;
}

.catalog {
  max-width: 1120px;
  margin: 0 auto;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.catalog-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 42px;
  background: var(--hero);
  color: var(--hero-text);
  position: relative;
  min-height: 320px;
  overflow: hidden;
  isolation: isolate;
}

.catalog-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--hero-cover-image);
  background-size: cover;
  background-position: center 58%;
  opacity: 0;
  transition: opacity 420ms ease;
}

.catalog-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(8, 13, 18, 0.7), rgba(8, 13, 18, 0.25));
  opacity: 0;
  transition: opacity 420ms ease;
}

.catalog-hero.show-cover-image::before,
.catalog-hero.show-cover-image::after {
  opacity: 1;
}

.catalog-hero.show-cover-image > * {
  opacity: 0;
  pointer-events: none;
}

.catalog-url {
  margin: 0 0 10px;
  color: color-mix(in srgb, var(--hero-text) 74%, transparent);
  font-size: 14px;
}

.catalog-hero h2 {
  font-size: clamp(36px, 6vw, 68px);
  line-height: 0.95;
  max-width: 760px;
}

.catalog-hero p {
  max-width: 640px;
}

.contact-card {
  min-width: 210px;
  border: 1px solid color-mix(in srgb, var(--hero-text) 24%, transparent);
  border-radius: 8px;
  padding: 16px;
  background: color-mix(in srgb, var(--hero-text) 10%, transparent);
  position: relative;
  overflow: hidden;
  align-self: stretch;
}

.contact-card span {
  display: block;
  margin-bottom: 6px;
  color: color-mix(in srgb, var(--hero-text) 74%, transparent);
  font-size: 13px;
}

.contact-card strong {
  font-size: 20px;
}

.contact-card small {
  display: block;
  margin-top: 6px;
  color: color-mix(in srgb, var(--hero-text) 70%, transparent);
  font-size: 12px;
}

.contact-slide {
  display: none;
}

.contact-slide.active {
  display: block;
}

.contact-data button {
  margin-top: 10px;
  width: 100%;
}

.catalog-products {
  padding: 28px;
}

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

.layout-list .catalog-products {
  display: grid;
  gap: 14px;
}

.product-card {
  display: grid;
  border: 1px solid #dce3e8;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.layout-list .product-card {
  grid-template-columns: 210px minmax(0, 1fr);
}

.product-media {
  position: relative;
  min-height: 200px;
  background: #eef2f4;
  overflow: hidden;
}

.product-media img {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  object-position: center center;
  display: block;
  transition: opacity 180ms ease;
}

.image-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 200px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #344b8f);
  font-size: 42px;
  font-weight: 900;
}

.category-chip {
  position: absolute;
  left: 12px;
  top: 12px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  color: #1f2d35;
  font-size: 12px;
  font-weight: 850;
  padding: 6px 8px;
  max-width: calc(100% - 24px);
}

.image-strip {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 6px;
}

.image-strip span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid #fff;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

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

.product-info h3 {
  font-size: 18px;
  line-height: 1.22;
}

.product-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #596874;
  font-size: 12px;
}

.product-meta span {
  border: 1px solid #e0e6ea;
  border-radius: 8px;
  padding: 5px 7px;
}

.product-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.price {
  color: var(--accent-dark);
  font-size: 26px;
  font-weight: 950;
}

.catalog-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid #dce3e8;
  color: var(--muted);
  padding: 18px 28px;
  font-size: 13px;
}

.order-receipt {
  max-width: 1120px;
  margin: 18px auto 0;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 34px;
}

.customer-shop {
  display: block;
}

.shop-header {
  margin: 0;
}

.shop-header h2 {
  font-size: clamp(30px, 5vw, 52px);
}

.shop-header p {
  margin: 8px 0 0;
  color: color-mix(in srgb, var(--hero-text) 76%, transparent);
}

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

.shop-product-media {
  min-height: 200px;
  background: #eef2f4;
  overflow: hidden;
}

.shop-product-media img,
.shop-product-media .image-fallback {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-position: center center;
}

img.is-changing {
  opacity: 0.35;
}

.category-line {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.shop-buy-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 9px;
  align-items: center;
}

.shop-cart {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 22px 28px 28px;
}

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

.receipt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 18px;
}

.receipt-header h2 {
  font-size: 30px;
}

.receipt-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.receipt-header > strong {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  white-space: nowrap;
}

.receipt-section {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.receipt-section h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.receipt-section p {
  margin: 6px 0;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.receipt-table th,
.receipt-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
}

.receipt-table th:nth-child(2),
.receipt-table td:nth-child(2) {
  text-align: center;
}

.receipt-table th:nth-child(3),
.receipt-table th:nth-child(4),
.receipt-table td:nth-child(3),
.receipt-table td:nth-child(4) {
  text-align: right;
}

.receipt-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding-top: 18px;
}

.receipt-total span {
  color: var(--muted);
  font-weight: 800;
}

.receipt-total strong {
  color: var(--accent-dark);
  font-size: 30px;
  font-weight: 950;
}

.whatsapp-dispatch p {
  color: var(--muted);
  margin: 0 0 12px;
}

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

.whatsapp-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  border: 1px dashed #b8c3cb;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-toolbar {
    grid-template-columns: 1fr 1fr;
  }

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

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

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

@media (max-width: 680px) {
  .control-panel,
  .workspace {
    padding: 14px;
  }

  .admin-tabs,
  .two-columns,
  .edit-choice-grid,
  .workspace-toolbar,
  .layout-grid .catalog-products,
  .layout-list .product-card {
    grid-template-columns: 1fr;
  }

  .catalog-hero,
  .catalog-footer,
  .shop-header {
    display: grid;
  }

  .catalog-hero {
    padding: 28px 22px;
  }

  .catalog-products {
    padding: 18px;
  }

  .shop-products {
    grid-template-columns: 1fr;
  }

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

  .receipt-header,
  .receipt-total {
    display: grid;
    justify-content: stretch;
  }

  .order-receipt {
    padding: 22px;
  }

  .manager-item,
  .category-heading {
    display: grid;
  }

  .row-actions {
    justify-content: stretch;
  }

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

@media print {
  body {
    background: #fff;
  }

  .control-panel,
  .workspace-toolbar {
    display: none !important;
  }

  .print-order .catalog,
  .print-order .customer-shop {
    display: none !important;
  }

  .print-order .order-receipt {
    display: block !important;
    box-shadow: none;
    margin: 0;
  }

  .app-shell,
  .workspace {
    display: block;
    padding: 0;
  }

  .catalog {
    max-width: none;
    box-shadow: none;
  }

  .product-card {
    break-inside: avoid;
  }
}
