@font-face { font-family: "Instrument Serif"; src: url("/fuentes/instrument-serif-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fuentes/instrument-serif-italic.woff2") format("woff2"); font-style: italic; font-display: swap; }
:root { color-scheme: light; --wine: #4a1728; --ink: #381c24; --line: #ded8da; --muted: #66464b; --paper: #fff; --surface: #f7f4f5; --sans: "Aptos", "Segoe UI", system-ui, sans-serif; --serif: "Instrument Serif", Georgia, serif; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--surface); font: 15px/1.55 var(--sans); }
[hidden] { display: none !important; }
a { color: var(--wine); text-underline-offset: .22em; }
header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 9px max(20px, 5vw); background: var(--wine); color: var(--paper); min-height: 62px; }
header a { color: inherit; font-size: 13px; text-decoration: none; }
header a:hover { text-decoration: underline; }
header > :last-child { grid-column: 3; justify-self: end; }
header :focus-visible { outline-color: var(--paper); }
.brand { display: inline-flex; grid-column: 2; }
.brand img { width: clamp(110px, 16vw, 140px); height: auto; display: block; }
.header-actions { display: flex; gap: clamp(10px, 3vw, 24px); align-items: center; }
header button, .secondary { color: var(--wine); background: var(--paper); }
header button { min-height: 40px; font-size: 13px; border-color: #ffffff80; color: var(--paper); background: transparent; }
header button:hover { background: var(--ink); }
main { width: min(100% - 40px, 1200px); margin: clamp(28px, 5vw, 64px) auto 72px; }
h1, h2, h3, p { margin: 0 0 12px; }
h1, h2 { color: var(--wine); font-family: var(--serif); font-weight: 400; line-height: 1; }
h1 { font-size: clamp(48px, 7vw, 76px); letter-spacing: -.025em; }
h2 { font-size: clamp(32px, 4vw, 43px); }
h3 { font-size: 16px; }
.admin-heading p, .section-copy, .login > p, #order-help, .tracking-help { color: var(--muted); }
.admin-heading { margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.admin-heading p { margin-bottom: 0; }
#status { color: var(--wine); font-weight: 600; margin: 12px 0; }
#status:empty { display: none; }
.card, .admin-nav { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 24px #381c2408; }
.card { padding: clamp(18px, 3vw, 36px); min-width: 0; }
.login { max-width: 440px; }
.login button, #tracking button { width: 100%; }
#dashboard { display: grid; grid-template-columns: 185px minmax(0, 1fr); gap: 22px; align-items: start; }
.admin-nav { display: grid; padding: 8px; gap: 4px; position: sticky; top: 16px; }
.admin-nav a { display: flex; justify-content: space-between; padding: 12px; border-radius: 9px; text-decoration: none; font-weight: 650; }
.admin-nav a:hover { background: #f4e9ed; }
.admin-nav a[aria-current] { background: var(--wine); color: var(--paper); }
.admin-page h1 { font-size: clamp(38px, 6vw, 60px); }
.login { margin-inline: auto; padding: clamp(24px, 4vw, 40px); }
.admin-page:has(#login:not([hidden])) .admin-heading { border: 0; padding-bottom: 0; }
.admin-page:has(#login:not([hidden])) .admin-heading,
.admin-page:has(#login:not([hidden])) main > #status { text-align: center; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.section-title h2 { margin: 0; }
.section-copy { margin-bottom: 24px; }
label { display: grid; gap: 6px; margin: 10px 0 15px; font-size: 13px; font-weight: 650; }
input, select, textarea, button { max-width: 100%; min-width: 0; min-height: 44px; padding: 9px 12px; color: inherit; background: var(--paper); border: 1px solid #dbd0d4; border-radius: 9px; font: 400 16px/1.35 var(--sans); }
button { color: var(--paper); background: var(--wine); border: 1px solid transparent; font-size: 14px; font-weight: 650; cursor: pointer; border-radius: 100px; padding-inline: 17px; }
button:hover { background: var(--ink); }
button.secondary { border-color: var(--line); }
button.secondary:hover { background: #f4e9ed; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 2px solid #9a4564; outline-offset: 3px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 15px; }
.wide { grid-column: 1 / -1; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 16px; padding: 12px 16px; }
legend { font-weight: 650; }
fieldset p { color: var(--muted); font-size: 13px; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photo { position: relative; display: grid; align-content: start; gap: 5px; width: 112px; }
.photo-cover { position: absolute; top: 6px; left: 6px; padding: 3px 8px; border-radius: 20px; color: var(--paper); background: var(--wine); font-size: 12px; font-weight: 650; }
.photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface); border-radius: 6px; }
.photo button { color: var(--wine); background: var(--paper); border-color: var(--line); font-size: 12px; }
summary { cursor: pointer; font-weight: 650; }
#more-orders { margin-top: 16px; }
.order-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; margin-bottom: 20px; background: var(--surface); padding: 15px; border-radius: 11px; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; justify-content: flex-end; }
#orders-count { margin-bottom: 12px; font-size: 13px; }
#orders-count:empty, #product-status:empty { display: none; }
.order-filters label { margin: 0; min-width: 0; }
.order-card { margin-top: 8px; border: 1px solid var(--line); border-radius: 11px; overflow-wrap: anywhere; }
.order-card summary { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 12px; align-items: center; padding: 14px; }
.order-card summary:hover { background: var(--surface); border-radius: 11px; }
.order-card summary::after { content: "+"; font-size: 20px; line-height: 1; color: var(--wine); }
.order-card[open] summary::after { content: "−"; }
.order-card summary small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.order-tag { padding: 4px 10px; border-radius: 20px; background: #f2eff0; font-size: 12px; text-align: center; }
.order-tag.fulfilment { color: var(--wine); background: #f4e6ec; }
.order-tag[data-state="approved"], .order-tag[data-state="entregado"] { color: #24573b; background: #e5f3ea; }
.order-tag[data-state="pending"], .order-tag[data-state="preparando"] { color: #744818; background: #faeedc; }
.order-tag[data-state="enviado"], .order-tag[data-state="listo"] { color: #29516a; background: #e9f1f6; }
.order-tag[data-state="cancelado"] { color: #872d37; background: #fae9eb; }
.order-body { border-top: 1px solid var(--line); padding: 14px; }
.order-body dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 12px; margin: 0; }
.order-body dt { color: var(--muted); }
.order-body dd { margin: 0; }
.order-actions { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.order-actions label, .order-actions p { margin: 0; }
.order-actions p:empty { display: none; }
.order-actions a { align-self: center; font-size: 13px; }
.empty-state { padding: 24px 14px; text-align: center; color: var(--muted); border: 1px dashed #dbd0d4; border-radius: 10px; margin: 0; }
.product-picker { max-width: 480px; }
.section-creator { margin: 14px 0 24px; padding: 12px 14px; background: var(--surface); border-radius: 9px; }
.section-creator form { max-width: 480px; }
#product-form h3 { margin-bottom: 0; }
#discount-price { color: var(--muted); }
.save-bar { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }

#product-status { margin: 0 auto 0 0; color: var(--wine); font-weight: 600; }
.tracking-page { background: var(--paper); }
.tracking-page main { width: min(100% - 48px, 1120px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: clamp(30px, 6vw, 94px); margin-block: clamp(28px, 6vw, 80px); }
.tracking-content { display: grid; min-width: 0; gap: 18px; padding-block: clamp(0px, 2vw, 24px); }
.tracking-photo { overflow: hidden; border-radius: 13px 13px 3px 3px; background: var(--surface); }
.tracking-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 4.65; object-fit: cover; }
.tracking-intro h1 { font-size: clamp(50px, 5.4vw, 80px); }
.tracking-intro p { max-width: 39ch; margin-bottom: 0; color: var(--muted); font-size: 16px; }
#tracking h2 { margin-bottom: 20px; }
#tracking label { margin-bottom: 8px; }
#order-help, .tracking-help { font-size: 13px; }
#order-help { margin-bottom: 19px; }
#tracking button { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#tracking { background: var(--surface); }
#tracking, #result { border-radius: 13px 13px 3px 3px; box-shadow: none; }
#tracking h2 { font-size: 34px; }
.tracking-help { margin: 0; }
.tracking-current { padding: 16px; background: var(--surface); border-radius: 10px; margin-bottom: 22px; }
.tracking-current p:last-child { margin: 0; }
.tracking-current[data-state="entregado"] { background: #edf4ef; }
.tracking-current[data-state="cancelado"] { background: #f9ecee; }
.tracking-number { overflow-wrap: anywhere; font-size: 13px; font-weight: 650; color: var(--muted); }
.tracking-timeline { padding: 0 0 0 12px; list-style: none; margin: 16px 0 0; }
.tracking-timeline li { position: relative; padding: 0 0 15px 18px; border-left: 1px solid #d9c4ce; }
.tracking-timeline li:last-child { padding-bottom: 0; border-color: transparent; }
.tracking-timeline li::before { content: ""; position: absolute; top: .45em; left: -5px; width: 9px; height: 9px; border: 1px solid #a36e85; background: white; border-radius: 50%; }
.tracking-timeline li:first-child::before { background: var(--wine); }
.tracking-timeline time { display: block; color: var(--muted); font-size: 13px; }

@media (max-width: 860px) {
  #dashboard { grid-template-columns: 1fr; gap: 12px; }
  .admin-nav { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 660px) {
  .order-filters, .order-card summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-filters label:first-child { grid-column: 1 / -1; }
  .order-card summary::after { display: none; }
  .tracking-page main { max-width: 500px; grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .tracking-photo { order: 1; }
  .tracking-photo img { aspect-ratio: 2.4; object-position: center 58%; }
  header { grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
  .brand { grid-column: 1; }
  header > :last-child { grid-column: 2; }
  .header-actions { justify-content: flex-end; flex-wrap: wrap; }
}
@media (max-width: 490px) { .fields { grid-template-columns: 1fr; } }
