:root {
  --forest: #143528;
  --forest-mid: #1b4332;
  --sage: #74a57f;
  --sage-soft: #a3c4a8;
  --white: #fbfefc;
  --surface: #f3f8f4;
  --ink: #15261d;
  --muted: #4a6354;
  --line: rgba(27, 67, 50, 0.12);
  --danger: #b42318;
  --ok: #1b7a45;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Sora", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.is-auth #view-login { display: none !important; }
body:not(.is-auth) #view-dash { display: none !important; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(163, 196, 168, 0.35), transparent 45%),
    linear-gradient(180deg, #eef6f0, var(--white));
  min-height: 100vh;
}
button, input { font: inherit; }
a { color: var(--forest-mid); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1.5px solid transparent;
  padding: 0.75rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.65; cursor: wait; transform: none; }
.btn-primary { background: var(--forest-mid); color: #f7fbf8; }
.btn-ghost {
  background: rgba(255,255,255,0.7);
  border-color: var(--line);
  color: var(--forest-mid);
}
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.75rem;
  box-shadow: 0 18px 40px rgba(12, 36, 25, 0.08);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--forest-deep, var(--forest));
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.login-brand img { width: 52px; height: 52px; object-fit: contain; }
.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0 0 0.4rem;
}
.login-lead { color: var(--muted); font-size: 0.92rem; margin: 0 0 1.25rem; }
.login-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
}
.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: #fff;
}
.login-card .btn-primary { width: 100%; margin-top: 1rem; }
.back-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  text-decoration: none;
}

.dash-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(251, 254, 252, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.dash-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.dash-brand img { width: 40px; height: 40px; object-fit: contain; }
.dash-brand strong { display: block; font-size: 0.95rem; }
.dash-brand span { font-size: 0.75rem; color: var(--muted); }
.dash-tabs { display: flex; gap: 0.35rem; }
.tab {
  border: 0;
  background: transparent;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.tab.is-active {
  background: rgba(116, 165, 127, 0.18);
  color: var(--forest-mid);
}

.dash-main { width: min(1180px, calc(100% - 2rem)); margin: 1.25rem auto 2.5rem; }
.panel-head h2 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
}
.panel-head p { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.92rem; }

.shop-layout {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 1.25rem;
  align-items: start;
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}
.product-card.is-out { opacity: 0.82; }
.product-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--surface);
}
.carousel {
  position: relative;
  background: var(--surface);
}
.carousel-track {
  position: relative;
  height: 140px;
}
.carousel-track img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.carousel-track img.is-active { opacity: 1; }
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 36, 28, 0.55);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.carousel-btn.prev { left: 0.4rem; }
.carousel-btn.next { right: 0.4rem; }
.carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.45rem;
  display: flex;
  justify-content: center;
  gap: 0.3rem;
}
.carousel-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(255,255,255,0.45);
  cursor: pointer;
}
.carousel-dots .dot.is-active { background: #fff; }
.stock-badge {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  background: rgba(120, 40, 40, 0.9);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}
.cat-tag {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand, #2d6a4f);
}
.product-traits {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: grid;
  gap: 0.25rem;
  font-size: 0.78rem;
}
.product-traits:empty { display: none; }
.product-traits li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
}
.product-traits strong { color: #1b4332; font-weight: 600; }
.product-card .body { padding: 0.95rem 1rem 1.1rem; }
.product-card h3 { margin: 0 0 0.35rem; font-size: 1rem; font-family: var(--font-display); }
.product-card p { margin: 0 0 0.65rem; color: var(--muted); font-size: 0.82rem; }
.product-card .cat-tag + h3 { margin-top: 0; }
.qty-row button:disabled,
.qty-row input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.qty-row { display: flex; gap: 0.4rem; }
.qty-row input {
  width: 64px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem;
}

.cart-panel {
  position: sticky;
  top: 84px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.15rem;
}
.cart-panel h2 { font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 0.85rem; }
.cart-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; min-height: 2rem; }
.cart-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.86rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.cart-summary {
  display: grid;
  gap: 0.4rem;
  margin: 0.85rem 0;
  font-size: 0.88rem;
}
.cart-summary div { display: flex; justify-content: space-between; gap: 0.5rem; }
.cart-note { font-size: 0.75rem; color: var(--muted); margin: 0.65rem 0 0; }

.checkout-view {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto 2rem;
}
.checkout-back { margin: 0.5rem 0 1rem; }
.checkout-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 1.25rem;
  align-items: start;
}
.checkout-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.35rem 1.4rem;
}
.checkout-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.checkout-card h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.checkout-sub { margin-top: 1.5rem; }
.delivery-days {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.45rem;
  min-height: 4.5rem;
  margin: 0.35rem 0 0.75rem;
}
.day-btn {
  border: 1px solid #d7dde3;
  background: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.2rem;
  font: inherit;
  color: #1b4332;
  cursor: pointer;
  display: grid;
  gap: 0.15rem;
  justify-items: center;
  align-content: center;
  min-width: 0;
  overflow: hidden;
}
.day-btn .day-label {
  font-size: 0.92rem;
  text-transform: lowercase;
  line-height: 1.1;
}
.day-btn .day-date {
  font-size: 0.72rem;
  color: #5c6f66;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-btn:hover { border-color: #74a57f; }
.day-btn.is-selected {
  border-color: #2d6a4f;
  background: rgba(45, 106, 79, 0.08);
  font-weight: 700;
}
.day-btn.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.day-calendar-btn .day-label { font-size: 1rem; }
.calendar-fallback {
  display: none;
}
.delivery-calendar-input.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.delivery-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.slot-btn {
  border: 1px solid #d7dde3;
  background: #fff;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 0.2rem;
  font: inherit;
  color: #1b4332;
}
.slot-btn span { color: #5c6f66; font-size: 0.85rem; }
.slot-btn:hover { border-color: #74a57f; }
.slot-btn.is-selected {
  border-color: #2d6a4f;
  background: rgba(45, 106, 79, 0.08);
}
.address-box {
  margin: 0 0 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7faf8;
  font-size: 0.95rem;
}
.checkout-summary .cart-summary strong {
  text-align: right;
  max-width: 55%;
  word-break: break-word;
}
.dash-tabs.is-dimmed { opacity: 0.45; pointer-events: none; }
@media (max-width: 900px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .delivery-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .delivery-slots { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .delivery-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.ficha-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
}
.ficha-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem;
}
.ficha-profile { margin-bottom: 1.15rem; }
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}
.profile-grid label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.profile-grid input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  pointer-events: none;
  caret-color: transparent;
}
.profile-grid .span-2 { grid-column: 1 / -1; }
.profile-grid label.is-expired input {
  color: #9b3b32;
  border-color: rgba(155, 59, 50, 0.35);
}
.lock-note { margin: 0.85rem 0 0; }
.ficha-card h3 { font-family: var(--font-display); margin: 0 0 0.75rem; }
.muted { color: var(--muted); font-size: 0.88rem; }
.docs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }
.docs-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.88rem;
}
.docs-list .meta { display: grid; gap: 0.15rem; }
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(116,165,127,0.2);
  color: var(--forest-mid);
}
.badge.pending { background: rgba(180, 120, 20, 0.15); color: #8a5a00; }
.recipe-form label, #recipe-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
}
#recipe-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  resize: vertical;
  margin-bottom: 0.75rem;
}
#recipe-form input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem;
  background: #fff;
}
.pending-box {
  margin-top: 1rem;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(180, 120, 20, 0.1);
  font-size: 0.86rem;
}

.orders-list { display: grid; gap: 0.85rem; }
.order-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
}
.order-head, .order-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
.order-meta {
  margin: 0.55rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.order-items { font-size: 0.9rem; }

.form-msg { min-height: 1.2em; font-size: 0.85rem; margin: 0.55rem 0 0; }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--ok); }

@media (max-width: 900px) {
  .shop-layout, .ficha-grid, .profile-grid { grid-template-columns: 1fr; }
  .profile-grid .span-2 { grid-column: auto; }
  .cart-panel { position: static; }
  .dash-header { flex-wrap: wrap; }
}
