:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --soft: #eef4ff;
  --text: #121826;
  --muted: #637083;
  --line: #e3e8ef;
  --green: #0a8f3d;
  --green-2: #25d366;
  --blue: #2563eb;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 18px 45px rgba(18, 24, 38, 0.09);
  --radius: 12px;
}

.dark {
  --bg: #0f172a;
  --panel: #111827;
  --soft: #172033;
  --text: #f8fafc;
  --muted: #a7b0c0;
  --line: #263244;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, sans-serif;
}

html {
  color-scheme: light;
}

.dark {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 24px 0;
}

a {
  color: inherit;
}

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

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.site-header,
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.dark .site-header,
.dark .app-topbar {
  background: rgba(17, 24, 39, 0.88);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-weight: 900;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
  width: min(1120px, calc(100% - 32px));
  margin: 34px auto 18px;
}

.hero-copy h1 {
  font-size: clamp(34px, 6vw, 68px);
  line-height: 1;
  margin-bottom: 16px;
  letter-spacing: 0;
}

.hero-copy p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 660px;
}

.hero-card,
.auth-card,
.panel,
.product-card,
.public-card,
.stat-card,
.store-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.hero-metrics div {
  padding: 14px;
  background: var(--soft);
  border-radius: var(--radius);
}

.hero-metrics strong {
  display: block;
  font-size: 24px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  margin: 18px auto 40px;
}

.auth-card {
  padding: 22px;
}

.auth-card h2,
.panel h2,
.store-hero h1 {
  margin-bottom: 8px;
}

.auth-card p,
.panel p,
.store-hero p {
  color: var(--muted);
  line-height: 1.5;
}

.field,
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  margin-top: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  outline: none;
  padding: 12px 13px;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(10, 143, 61, 0.12);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 900;
}

.primary-btn {
  color: #ffffff;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.secondary-btn {
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--line);
}

.ghost-btn {
  color: var(--green);
  background: rgba(10, 143, 61, 0.09);
}

.danger-btn {
  color: var(--red);
  background: rgba(220, 38, 38, 0.09);
}

.button-row,
.inline-actions,
.store-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.button-row {
  margin-top: 16px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.nav-link {
  text-align: left;
  border: 0;
  border-radius: 10px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.nav-link.active,
.nav-link:hover {
  color: var(--green);
  background: rgba(10, 143, 61, 0.09);
}

.main {
  min-width: 0;
  padding: 22px;
}

.grid-4,
.grid-3,
.grid-2 {
  display: grid;
  gap: 16px;
}

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

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

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

.stat-card,
.panel {
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.panel-section {
  display: none;
}

.active-section {
  display: block;
}

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

.store-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.product-toolbar,
.store-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
  margin: 16px 0;
}

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

.product-card,
.public-card {
  overflow: hidden;
}

.product-card {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
}

.product-card img,
.public-card img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
  background: var(--soft);
}

.product-card > div,
.public-card > div {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.badge {
  display: inline-flex;
  width: max-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.order-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.order-row span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.store-page {
  width: min(1060px, calc(100% - 28px));
  margin: 18px auto 80px;
}

.store-hero {
  overflow: hidden;
  margin-bottom: 16px;
}

.store-banner {
  width: 100%;
  height: 230px;
  object-fit: cover;
}

.store-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
}

.store-logo {
  width: 86px;
  height: 86px;
  border-radius: 18px;
  object-fit: cover;
  border: 4px solid var(--panel);
  box-shadow: var(--shadow);
}

.store-actions {
  padding: 0 18px 18px;
}

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

.public-card {
  display: grid;
}

.public-card img {
  aspect-ratio: 1 / 1;
}

.qr-box {
  padding: 0 18px 18px;
}

.whatsapp-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  padding: 13px 16px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green-2);
  text-decoration: none;
  font-weight: 900;
  box-shadow: var(--shadow);
}

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

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.empty-state {
  padding: 26px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: none;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 10px;
  color: #ffffff;
  background: #101828;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.toast.show {
  display: block;
}

.toast[data-type="error"] {
  background: var(--red);
}

@media (max-width: 1050px) {
  .hero,
  .auth-grid,
  .grid-4,
  .grid-3,
  .grid-2,
  .public-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 780px) {
  .hero,
  .auth-grid,
  .grid-4,
  .grid-3,
  .grid-2,
  .store-form-grid,
  .product-list,
  .public-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    padding: 14px;
  }

  .product-toolbar,
  .store-tools {
    grid-template-columns: 1fr;
  }

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

  .site-header,
  .app-topbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .store-identity {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row > *,
  .store-actions > * {
    width: 100%;
  }
}
