:root {
  --bg: #f2efe6;
  --bg-deep: #e4ddd0;
  --surface: #fffcf7;
  --ink: #1a2420;
  --muted: #5c6b63;
  --brand: #0f3d2e;
  --brand-2: #1a5c45;
  --accent: #c45c26;
  --accent-soft: #f3e0d4;
  --ok: #1f6b4a;
  --err: #9b2c2c;
  --line: rgba(26, 36, 32, 0.12);
  --shadow: 0 10px 30px rgba(15, 61, 46, 0.08);
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 68px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(196, 92, 38, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(15, 61, 46, 0.14), transparent 50%),
    linear-gradient(180deg, #f7f4ec 0%, var(--bg) 40%, var(--bg-deep) 100%);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(15, 61, 46, 0.94);
  color: #f7f4ec;
  box-shadow: 0 2px 16px rgba(0,0,0,.18);
}
.topbar__inner {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: .5rem;
  max-width: 720px;
  margin: 0 auto;
  padding: .85rem 1rem;
}
.topbar__brand, .topbar__back {
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .02em;
}
.topbar__back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
}
.topbar__title {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
}
.topbar__user {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  justify-self: end;
}
.topbar__spacer { width: 40px; height: 40px; }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem calc(var(--nav-h) + var(--safe-b) + 1.25rem);
}
.main--full { padding-bottom: 1.5rem; }

.flash {
  padding: .85rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  font-weight: 500;
}
.flash--ok { background: #d9efe4; color: var(--ok); }
.flash--error { background: #f8dede; color: var(--err); }

.hero-card {
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #f7f4ec;
  border-radius: 24px;
  padding: 1.4rem 1.3rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.1rem;
}
.hero-card h2 {
  font-family: var(--display);
  margin: 0 0 .35rem;
  font-size: 1.55rem;
}
.hero-card p { margin: 0; opacity: .85; }

.menu-grid {
  display: grid;
  gap: .85rem;
}
.menu-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.menu-btn:active { transform: scale(.98); }
.menu-btn__ico {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 700;
}
.menu-btn__text strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: .15rem;
}
.menu-btn__text span {
  color: var(--muted);
  font-size: .9rem;
}

.auth-wrap {
  min-height: calc(100dvh - 70px);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
}
.auth-card h2 {
  font-family: var(--display);
  margin: 0 0 .25rem;
  text-align: center;
}
.auth-card .sub {
  text-align: center;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.form { display: grid; gap: .9rem; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: .85rem .95rem;
  font: inherit;
  color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(15, 61, 46, .25);
  border-color: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 0;
  border-radius: 14px;
  padding: .95rem 1.1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
}
.btn--primary {
  background: var(--brand);
  color: #fff;
  width: 100%;
}
.btn--accent {
  background: var(--accent);
  color: #fff;
}
.btn--ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn--danger {
  background: #f3d6d6;
  color: var(--err);
}
.btn--sm {
  padding: .55rem .8rem;
  border-radius: 10px;
  font-size: .88rem;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.link-muted {
  display: block;
  text-align: center;
  margin-top: 1rem;
  color: var(--muted);
  font-size: .92rem;
}

.searchbar {
  display: flex;
  gap: .55rem;
  margin-bottom: 1rem;
}
.searchbar input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem .95rem;
  font: inherit;
  background: #fff;
}

.list { display: grid; gap: .7rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .95rem 1rem;
  box-shadow: var(--shadow);
}
.card__top {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
}
.card__code {
  font-size: .75rem;
  font-weight: 700;
  color: var(--brand);
  background: rgba(15,61,46,.08);
  padding: .2rem .5rem;
  border-radius: 999px;
}
.card__title {
  margin: .35rem 0 .2rem;
  font-size: 1.02rem;
  font-weight: 650;
}
.card__meta {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.35;
}
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--bg-deep);
}
.badge--ok { background: #d9efe4; color: var(--ok); }
.badge--off { background: #f0e4e4; color: var(--err); }
.badge--warn { background: #f7e8d4; color: #8a4b12; }

.prod-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: .75rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .65rem;
  box-shadow: var(--shadow);
}
.prod-row img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  background: #eee;
}
.prod-row__name { font-weight: 650; font-size: .95rem; }
.prod-row__rubro { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.prod-row__price { font-weight: 700; color: var(--brand); white-space: nowrap; }

.total-bar {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-b) + .5rem);
  background: var(--brand);
  color: #fff;
  border-radius: 16px;
  padding: .95rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 12px 28px rgba(15,61,46,.28);
  margin-top: 1rem;
  z-index: 20;
}
.total-bar strong { font-size: 1.2rem; font-family: var(--display); }

.qty {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.qty input {
  width: 64px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .45rem;
  font: inherit;
}

.bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .15rem;
  background: rgba(255,252,247,.96);
  border-top: 1px solid var(--line);
  padding: .35rem .35rem calc(.35rem + var(--safe-b));
  backdrop-filter: blur(10px);
}
.bottomnav:has(a:nth-child(5)) {
  grid-template-columns: repeat(5, 1fr);
}
.bottomnav__item {
  display: grid;
  place-items: center;
  gap: .1rem;
  padding: .45rem .2rem;
  border-radius: 12px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
}
.bottomnav__ico { font-size: 1.1rem; line-height: 1; }
.bottomnav__item.is-active {
  color: var(--brand);
  background: rgba(15,61,46,.08);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}
.muted { color: var(--muted); }
.mt-1 { margin-top: .75rem; }
.mb-1 { margin-bottom: .75rem; }
.text-right { text-align: right; }
.table-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.table-mini th, .table-mini td {
  padding: .55rem .2rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table-mini th { color: var(--muted); font-size: .75rem; }
