:root {
  --bg: #eef2f7;
  --bg-2: #dfe6f0;
  --ink: #142033;
  --muted: #4d5d73;
  --card: rgba(255, 255, 255, 0.82);
  --line: rgba(20, 32, 51, 0.12);
  --accent: #1d4f91;
  --accent-2: #2f6fbf;
  --danger: #9b2c2c;
  --ok: #1d4f91;
  --shadow: 0 18px 50px rgba(20, 32, 51, 0.1);
  --radius: 22px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(47, 111, 191, 0.18), transparent 28%),
    linear-gradient(160deg, #f3f6fb 0%, #e7eef8 45%, #d9e4f2 100%);
}

.bg-glow {
  position: fixed;
  inset: auto -10vw -20vh auto;
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle, rgba(29, 79, 145, 0.16), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: min(920px, calc(100% - 1.5rem));
  margin: 0 auto 2rem;
  position: relative;
  z-index: 1;
}
.container.narrow { width: min(560px, calc(100% - 1.5rem)); }

.topbar {
  width: min(920px, calc(100% - 1.5rem));
  margin: 1rem auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--display); font-size: 1.05rem; }
.brand small { color: var(--muted); font-size: 0.82rem; }
.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.9rem;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), #163a6d);
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.nav-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}
.nav-actions a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: var(--ink);
  color: white !important;
  text-decoration: none;
  font-size: 0.88rem;
}

.hero-card, .product, .order-card, .stat, .admin-link, .total-box {
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.hero-card {
  border-radius: calc(var(--radius) + 4px);
  padding: 1.4rem;
}
.hero-card.center { text-align: center; }
.hero-card h1, .section-head h1, .order-card h2, .product h2 {
  font-family: var(--display);
  margin: 0.2rem 0 0.55rem;
  line-height: 1.15;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  margin: 0;
}
.lede, .product p, .hint { color: var(--muted); }
.hint { font-size: 0.9rem; }

.stack { display: grid; gap: 0.9rem; }
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  font: inherit;
  background: rgba(255,255,255,0.92);
  color: var(--ink);
}
textarea { resize: vertical; }

.btn {
  border: 0;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #d7e2f0;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.btn.primary {
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: white;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

.product-list, .stack { display: grid; gap: 0.85rem; }
.product, .order-card {
  border-radius: var(--radius);
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
}
.meta {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.inline-form {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}
.inline-form input[type="number"] { width: 5rem; }
.inline-form select { width: auto; min-width: 9rem; }

.total-box {
  border-radius: 18px;
  padding: 1rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.total-box.compact { box-shadow: none; }

.alert, .success {
  border-radius: 16px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.9rem;
  font-weight: 600;
}
.alert { background: #fde8e8; color: var(--danger); }
.success { background: #e5eefb; color: var(--ok); }

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat {
  border-radius: 18px;
  padding: 1rem;
}
.stat span { color: var(--muted); display: block; font-size: 0.85rem; }
.stat strong { font-family: var(--display); font-size: 1.6rem; }

.admin-grid {
  display: grid;
  gap: 0.75rem;
}
.admin-link {
  border-radius: 18px;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
}
.admin-actions {
  display: grid;
  gap: 0.55rem;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.order-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}
.order-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}
.status {
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #e7ecf2;
}
.status-nuevo { background: #fff4d6; }
.status-preparando { background: #ddecff; }
.status-listo { background: #d9e8fb; }
.status-entregado { background: #e8e8e8; }
.status-cancelado { background: #fde8e8; color: var(--danger); }

.qr {
  width: min(280px, 70vw);
  border-radius: 18px;
  margin: 1rem 0;
  background: white;
  padding: 0.6rem;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
  color: var(--muted);
}

@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .inline-form { flex-wrap: wrap; }
  .section-head { flex-direction: column; align-items: start; }
}
