:root {
  /* Marca MEXVACAY */
  --pink: #ec1e79;
  --cyan: #29b6e8;
  --blue: #21409a;
  --orange: #f7a81b;
  --green: #3bb54a;
  /* Sistema glass */
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --bg: #f5f5f7;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.65);
  --hairline: rgba(0, 0, 0, 0.06);
  --shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
  --blur: saturate(180%) blur(22px);
  --ok: #2e7d52;
  --warn: #b26a00;
  --err: #c0392b;
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Manchas de color ambiental detrás del glass */
body::before, body::after {
  content: '';
  position: fixed;
  width: 55vw; height: 55vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .22;
  z-index: -1;
  pointer-events: none;
}
body::before { background: var(--cyan); top: -18vw; left: -12vw; }
body::after { background: var(--pink); bottom: -22vw; right: -14vw; }

h1, h2, h3 { color: var(--ink); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 22px; }

.logo-img { height: 34px; display: block; }

.brand-top { display: flex; align-items: center; gap: 14px; }
.brand-top .logo-img { height: 30px; }
.brand-top span {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1.5px; padding-top: 2px;
}

/* Franja de papel picado (motivos de marca) */
.picado {
  height: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='26' viewBox='0 0 180 26'%3E%3Cg fill='%23f7a81b'%3E%3Ccircle cx='22' cy='6' r='4'/%3E%3Ccircle cx='22' cy='20' r='4'/%3E%3Ccircle cx='15' cy='13' r='4'/%3E%3Ccircle cx='29' cy='13' r='4'/%3E%3C/g%3E%3Ccircle cx='22' cy='13' r='3.2' fill='%23ec1e79'/%3E%3Cpath d='M62 8 c-3-5-10-2-8 3 1.5 3.5 8 8 8 8 s6.5-4.5 8-8 c2-5-5-8-8-3z' fill='%23ec1e79'/%3E%3Crect x='96' y='7' width='12' height='12' transform='rotate(45 102 13)' fill='%2329b6e8'/%3E%3Cg fill='%233bb54a'%3E%3Cellipse cx='138' cy='13' rx='7' ry='3.4' transform='rotate(-35 138 13)'/%3E%3Cellipse cx='152' cy='13' rx='7' ry='3.4' transform='rotate(35 152 13)'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center;
}

/* ===== Barra superior (glass sticky) ===== */
header.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hairline);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}

nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
nav.tabs button {
  background: transparent; border: none; color: #48484a;
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 14px;
  transition: background .15s, color .15s;
}
nav.tabs button:hover { background: rgba(0, 0, 0, .05); }
nav.tabs button.active {
  background: #fff; color: var(--blue); font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}
nav.tabs a {
  color: var(--pink); padding: 8px 14px; font-size: 14px;
  text-decoration: none; font-weight: 500;
}
.hello {
  background: rgba(41, 182, 232, .14); color: #0f7fae;
  padding: 7px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
}

main { max-width: 1000px; margin: 28px auto; padding: 0 16px 60px; }

.card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 18px;
}

/* ===== Formularios ===== */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; }
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  font-size: 15px;
  background: rgba(255, 255, 255, .75);
  font-family: inherit;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(41, 182, 232, .18);
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }

button.btn {
  background: var(--blue);
  color: #fff; border: none;
  padding: 11px 24px; border-radius: 12px;
  font-size: 15px; font-weight: 500; cursor: pointer; margin-top: 16px;
  box-shadow: 0 2px 12px rgba(33, 64, 154, .25);
  transition: transform .12s, filter .15s, box-shadow .15s;
}
button.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
button.btn:active { transform: translateY(0); }
button.btn.accent {
  background: linear-gradient(135deg, var(--pink), #ff5ea3);
  font-weight: 600;
  box-shadow: 0 2px 14px rgba(236, 30, 121, .3);
}
button.btn.ghost {
  background: rgba(255, 255, 255, .6);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: none;
}
button.btn.small { padding: 7px 14px; font-size: 13px; margin-top: 0; border-radius: 999px; }
button.btn.danger { background: var(--err); box-shadow: 0 2px 12px rgba(192, 57, 43, .25); }
button.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
a.btn-link {
  display: inline-block; background: rgba(41, 182, 232, .14); color: #1181b1;
  text-decoration: none; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
}
a.btn-link:hover { background: rgba(41, 182, 232, .24); }

/* ===== Tablas ===== */
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th {
  text-align: left; padding: 10px; color: var(--muted);
  font-weight: 600; border-bottom: 1px solid var(--hairline); font-size: 11px;
  text-transform: uppercase; letter-spacing: .8px;
}
table.list td { padding: 12px 10px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: rgba(255, 255, 255, .45); }

.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.sent { background: rgba(247, 168, 27, .16); color: var(--warn); }
.badge.paid { background: rgba(59, 181, 74, .16); color: var(--ok); }
.badge.completed { background: rgba(33, 64, 154, .12); color: var(--blue); }
.badge.cancelled, .badge.expired { background: rgba(192, 57, 43, .12); color: var(--err); }
.badge.draft { background: rgba(0, 0, 0, .06); color: var(--muted); }

.price { font-weight: 700; color: var(--blue); white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-box {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  padding: 44px 40px; border-radius: 24px;
  width: 100%; max-width: 380px; text-align: center;
  box-shadow: var(--shadow);
}
.login-box .logo-img { height: 44px; margin: 0 auto 26px; }
.login-box label { text-align: left; }

/* ===== Modal ===== */
.modal-bg {
  position: fixed; inset: 0; background: rgba(29, 29, 31, .35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal {
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 28px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}
.modal h3 { margin-bottom: 8px; }

/* ===== Selección de servicio por cards ===== */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.chips button {
  border: 1px solid var(--hairline); background: rgba(255, 255, 255, .6);
  color: #48484a; padding: 7px 15px; border-radius: 999px; font-size: 13px;
  cursor: pointer; transition: all .15s;
}
.chips button:hover { background: #fff; }
.chips button.active {
  background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 500;
}
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}
.service-card {
  background: rgba(255, 255, 255, .72);
  border: 1.5px solid var(--hairline);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .13s, box-shadow .15s, border-color .15s;
  text-align: left;
  padding: 0;
  font-family: inherit;
}
.service-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(31, 38, 135, .12); }
.service-card.selected {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(236, 30, 121, .18), 0 8px 22px rgba(31, 38, 135, .12);
}
.service-card .sc-photo {
  height: 86px; width: 100%; object-fit: cover; display: block;
}
.service-card .sc-photo-ph {
  height: 86px; display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  background: linear-gradient(135deg, rgba(41, 182, 232, .18), rgba(236, 30, 121, .14));
}
.service-card .sc-body { padding: 10px 12px 12px; }
.service-card .sc-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.service-card .sc-price { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.service-card.selected .sc-price { color: var(--pink); font-weight: 600; }

.msg { padding: 11px 14px; border-radius: 12px; margin: 12px 0; font-size: 14px; }
.msg.ok { background: rgba(59, 181, 74, .14); color: var(--ok); }
.msg.err { background: rgba(192, 57, 43, .12); color: var(--err); }

/* ===== Modal de orden creada ===== */
.success-head { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }
.modal-check {
  flex: 0 0 54px; width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #3bb54a, #7ed957);
  color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(59, 181, 74, .35);
}
.success-head h3 { font-size: 20px; }
.success-amount { color: var(--pink); font-weight: 700; font-size: 15px; margin-top: 2px; }
.link-row { display: flex; gap: 8px; align-items: stretch; }
.link-row input {
  flex: 1; font-size: 13px; color: var(--muted); min-width: 0;
}
.link-row .btn { margin: 0; white-space: nowrap; padding: 11px 18px; }
.action-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-top: 18px;
}
.action-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 18px 8px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--hairline); border-radius: 16px;
  text-decoration: none; color: var(--ink);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: transform .13s, box-shadow .15s;
}
.action-tile span { font-size: 30px; line-height: 1; }
.action-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(31, 38, 135, .13); }
.action-tile.wa { background: rgba(37, 211, 102, .16); color: #0e7a41; }
@media (max-width: 480px) {
  .action-grid { grid-template-columns: 1fr 1fr; }
  .action-tile.wa { grid-column: 1 / -1; }
}

.hidden { display: none !important; }

.photo-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-thumbs .thumb { position: relative; }
.photo-thumbs img {
  width: 84px; height: 62px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--hairline);
}
.photo-thumbs .thumb button {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: var(--err); color: #fff; font-size: 11px; cursor: pointer; line-height: 1;
}

/* ===== Página pública de orden ===== */
.order-page { max-width: 520px; margin: 40px auto; padding: 0 16px; }
.order-card {
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 24px; overflow: hidden;
  box-shadow: var(--shadow);
}
.order-head { text-align: center; padding: 24px 20px 14px; }
.order-head .logo-img { height: 46px; margin: 0 auto; }
.order-head .tagline {
  color: var(--cyan); font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; margin-top: 7px;
}
.order-body { padding: 26px 28px 30px; }
.order-body h2 { font-size: 22px; margin-bottom: 4px; color: var(--blue); }
.detail-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--hairline); font-size: 14px;
}
.detail-row span:first-child { color: var(--muted); }
.detail-row span:last-child { font-weight: 600; text-align: right; }
.total-row {
  display: flex; justify-content: space-between; padding: 18px 0 4px;
  font-size: 21px; font-weight: 700; color: var(--pink);
}
.pay-btn {
  display: block; width: 100%; margin-top: 20px; padding: 16px;
  background: linear-gradient(135deg, var(--pink), #ff5ea3);
  color: #fff; border: none; border-radius: 14px;
  font-size: 17px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 18px rgba(236, 30, 121, .35);
  transition: transform .12s, filter .15s;
}
.pay-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.pay-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.paid-stamp {
  text-align: center; padding: 14px; border-radius: 14px; margin-top: 20px;
  background: rgba(59, 181, 74, .15); color: var(--ok); font-weight: 700; font-size: 17px;
}
.order-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }
.voucher-cta {
  display: block; text-align: center; margin-top: 12px; padding: 13px;
  background: rgba(41, 182, 232, .16); color: #1181b1;
  border-radius: 14px; text-decoration: none; font-weight: 600;
}
.voucher-cta:hover { background: rgba(41, 182, 232, .26); }

/* ===== Carátula (voucher.html) — documento blanco imprimible ===== */
.voucher-page { max-width: 820px; margin: 24px auto; padding: 0 14px 50px; }
.voucher {
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow);
}
.voucher-inner { padding: 26px 32px; }
.voucher-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.voucher-top .logo-img { height: 48px; }
.voucher-title { text-align: right; }
.voucher-title .kicker {
  color: var(--pink); font-weight: 800; font-size: 20px; letter-spacing: 1px;
}
.voucher-title h1 {
  color: var(--blue); font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: .5px;
}
.voucher-cols { display: flex; gap: 28px; flex-wrap: wrap; }
.voucher-cols > div { flex: 1; min-width: 240px; }
.v-field { margin-bottom: 13px; }
.v-field .k {
  font-weight: 800; font-size: 13px; text-transform: uppercase; color: var(--ink);
  border-bottom: 2.5px solid var(--ink); display: inline-block; margin-bottom: 3px; letter-spacing: .5px;
}
.v-field .v { font-size: 15px; }
.v-total { color: var(--pink); font-size: 24px; font-weight: 800; margin: 10px 0 14px; }
.v-text { font-size: 14px; white-space: pre-line; }
.voucher-photos { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.voucher-photos img {
  flex: 1; min-width: 220px; max-width: 100%; height: 230px;
  object-fit: cover; border-radius: 10px;
}
.voucher-cancel {
  background: #f0f0f0; padding: 16px 32px; display: flex; gap: 18px; align-items: center;
}
.voucher-cancel .vc-title { font-weight: 800; font-size: 16px; min-width: 110px; color: var(--ink); }
.voucher-cancel .vc-text { font-size: 12.5px; color: #555; white-space: pre-line; }
.voucher-code { text-align: center; color: var(--muted); font-size: 12px; padding: 10px; }

/* ===== Sign (sign.html) — documento blanco imprimible ===== */
.sign-page { max-width: 900px; margin: 24px auto; padding: 0 14px 50px; }
.sign {
  background: #fff; border-radius: 16px; overflow: hidden; text-align: center;
  box-shadow: var(--shadow);
}
.sign .picado { height: 40px; }
.sign-inner { padding: 40px 24px 56px; }
.sign-inner .logo-img { height: 52px; margin: 0 auto 40px; }
.sign-name {
  color: var(--blue); font-size: clamp(44px, 9vw, 96px); font-weight: 900;
  line-height: 1.02; letter-spacing: 1px; text-transform: capitalize;
}
.sign-villa {
  color: var(--pink); font-size: clamp(26px, 4.5vw, 46px); font-weight: 700; margin-top: 28px;
}

.print-bar { text-align: center; margin: 18px 0; }

/* ===== Impresión (guardar como PDF) ===== */
@media print {
  body { background: #fff; }
  body::before, body::after { display: none; }
  .no-print { display: none !important; }
  .voucher-page, .sign-page { max-width: 100%; margin: 0; padding: 0; }
  .voucher, .sign { box-shadow: none; border-radius: 0; }
  .voucher-photos img { height: 200px; }
  @page { margin: 8mm; }
}

@media (max-width: 640px) {
  main { margin-top: 12px; }
  .card { padding: 18px; }
  table.list { font-size: 13px; }
  table.list td, table.list th { padding: 8px 6px; }
  .voucher-inner { padding: 18px; }
  .voucher-title { text-align: left; }
}
