/* =================== ATENEA · Estilos =================== */
:root {
  --primario: #B8925A;     /* dorado */
  --secundario: #6B655F;   /* gris topo */
  --fondo: #EDE6DB;        /* crema */
  --superficie: #FBF8F3;   /* tarjetas */
  --texto: #3F3A35;

  --borde: color-mix(in srgb, var(--secundario) 18%, transparent);
  --suave: color-mix(in srgb, var(--primario) 12%, var(--superficie));
  --muted: color-mix(in srgb, var(--texto) 58%, var(--fondo));
  --ok: #6E8B5E;
  --warn: #C08A3E;
  --bad: #B0574B;
  --info: #6F7F95;

  --r: 16px;
  --r-sm: 10px;
  --sombra: 0 1px 2px rgba(60,50,40,.05), 0 8px 24px -12px rgba(60,50,40,.18);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
svg { width: 20px; height: 20px; flex-shrink: 0; }
a.btn { text-decoration: none; color: inherit; }
a.btn-primary { color: #fff; }
.pill svg { width: 13px; height: 13px; }
.sec-title svg { width: 18px; height: 18px; vertical-align: -3px; }
.search > span { display: contents; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: .01em; }

/* ---------- SPLASH (estilo Facebook) ---------- */
#splash {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--fondo);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity .45s ease, visibility .45s;
}
#splash.out { opacity: 0; visibility: hidden; }
.splash-center { flex: 1; display: flex; align-items: center; justify-content: center; }
#splashLogo {
  width: 132px; height: auto;
  animation: logoIn .9s cubic-bezier(.2,.9,.25,1.25) both, logoPulse 1.6s ease-in-out .95s infinite;
}
.splash-bottom {
  padding-bottom: calc(44px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  animation: fadeUp .7s ease .45s both;
}
.splash-from { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.splash-name {
  font-family: var(--serif); font-size: 22px; letter-spacing: .38em; padding-left: .38em;
  color: var(--primario); font-weight: 600;
}
@keyframes logoIn { 0% { opacity: 0; transform: scale(.55); } 100% { opacity: 1; transform: scale(1); } }
@keyframes logoPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- AUTH ---------- */
.screen {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  animation: fadeUp .5s ease both;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--superficie);
  border-radius: 24px;
  padding: 28px 24px 22px;
  box-shadow: var(--sombra);
}
.auth-logo { display: block; width: 170px; margin: 0 auto 10px; }
.auth-logo.small { width: 90px; }
.auth-title { font-size: 30px; text-align: center; margin: 6px 0 18px; }
.demo-banner {
  background: var(--suave); border: 1px dashed var(--primario);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; margin-bottom: 8px;
}
.auth-sep { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--muted); font-size: 12px; }
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--borde); }

/* ---------- FORM ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea, .input {
  width: 100%;
  background: var(--fondo);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, background .2s;
  font-size: 16px; /* evita zoom en iOS */
}
.field textarea, textarea.input { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--primario); background: var(--superficie); }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 48px; }
.eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted);
}
.eye svg { width: 21px; height: 21px; }
.check { display: flex; align-items: center; gap: 10px; margin: 2px 0 16px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primario); }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 420px) { .row3 { grid-template-columns: 1fr 1fr; } }

/* ---------- BOTONES ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 500;
  letter-spacing: .02em; transition: transform .1s, filter .2s, background .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primario); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-dark { background: var(--secundario); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--borde); }
.btn-soft { background: var(--suave); color: var(--texto); }
.btn-danger { background: transparent; color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.link { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--secundario); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--secundario);
}
.icon-btn:hover { background: var(--suave); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- LAYOUT APP ---------- */
#app { min-height: 100%; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: color-mix(in srgb, var(--fondo) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--borde);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand-name { font-family: var(--serif); font-size: 21px; letter-spacing: .18em; text-transform: uppercase; line-height: 1; }
.brand-sub { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--primario); margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sync-dot.off { background: var(--warn); }
.menu {
  position: absolute; right: 12px; top: calc(100% + 6px);
  background: var(--superficie); border-radius: 14px; box-shadow: var(--sombra);
  min-width: 220px; padding: 6px; border: 1px solid var(--borde);
  animation: fadeUp .18s ease both;
}
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 11px 12px; border-radius: 10px; }
.menu button:hover { background: var(--suave); }
.menu-user { padding: 10px 12px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--borde); margin-bottom: 4px; word-break: break-all; }

.view {
  max-width: 1100px; margin: 0 auto;
  padding: 18px 16px calc(96px + var(--safe-b));
  animation: fadeUp .3s ease both;
}
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--superficie);
  border-top: 1px solid var(--borde);
  padding: 6px 4px calc(6px + var(--safe-b));
}
.nav button {
  background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--muted); padding: 6px 0; border-radius: 12px;
}
.nav button svg { width: 23px; height: 23px; }
.nav button.on { color: var(--primario); }
.nav button.on svg { stroke-width: 2; }

@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .nav {
    position: sticky; top: 70px; align-self: start;
    display: flex; flex-direction: column; gap: 4px;
    background: transparent; border: 0; padding: 18px 12px; height: calc(100vh - 70px);
  }
  .nav button { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 12px 14px; }
  .nav button.on { background: var(--superficie); box-shadow: var(--sombra); }
  .view { padding-bottom: 40px; margin: 0; width: 100%; }
}

/* ---------- COMPONENTES ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; line-height: 1.05; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.card { background: var(--superficie); border-radius: var(--r); box-shadow: var(--sombra); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-title { font-family: var(--serif); font-size: 21px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title .link { margin: 0; font-family: var(--sans); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--superficie); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--sombra); position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -18px; top: -18px; width: 70px; height: 70px; border-radius: 50%; background: var(--suave); }
.stat .lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); position: relative; z-index: 1; }
.stat .val { font-family: var(--serif); font-size: 32px; line-height: 1.1; margin-top: 4px; position: relative; z-index: 1; }
.stat .hint { font-size: 12px; color: var(--muted); position: relative; z-index: 1; }
.grid2 { display: grid; gap: 14px; }
.grid2 .card + .card { margin-top: 0; }
@media (min-width: 800px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--borde); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%;
}
.item:last-child { border-bottom: 0; }
button.item:hover { background: color-mix(in srgb, var(--suave) 60%, transparent); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time-badge { font-family: var(--serif); font-size: 19px; min-width: 54px; color: var(--secundario); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 500; font-size: 14px;
  background: var(--suave); color: var(--primario); letter-spacing: .03em;
}
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 14px; }
.empty svg { width: 34px; height: 34px; color: var(--primario); opacity: .6; display: block; margin: 0 auto 8px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: var(--suave); color: var(--secundario); white-space: nowrap; }
.pill.pendiente { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.pill.confirmado { background: color-mix(in srgb, var(--primario) 18%, transparent); color: color-mix(in srgb, var(--primario) 75%, #000); }
.pill.realizado { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.cancelado { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); }
.pill.alert { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar .input { flex: 1 1 180px; width: auto; padding: 10px 14px; background: var(--superficie); border: 1px solid var(--borde); }
.toolbar select.input { flex: 1 1 150px; }
.search { position: relative; flex: 1 1 220px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search .input { width: 100%; padding-left: 40px; }

.tabs { display: flex; gap: 6px; background: var(--fondo); border-radius: 999px; padding: 4px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--superficie); color: var(--texto); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.fab {
  position: fixed; right: 18px; bottom: calc(84px + var(--safe-b)); z-index: 55;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--primario); color: #fff; box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--primario) 80%, #000);
  display: grid; place-items: center;
}
.fab svg { width: 26px; height: 26px; }
@media (min-width: 900px) { .fab { bottom: 28px; right: 28px; } }

/* ---------- AGENDA ---------- */
.agenda { display: grid; gap: 14px; }
@media (min-width: 900px) { .agenda { grid-template-columns: 360px 1fr; align-items: start; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { font-size: 24px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; border: 0; background: transparent; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 15px; position: relative;
}
.cal-day:hover { background: var(--suave); }
.cal-day.off { color: color-mix(in srgb, var(--texto) 35%, transparent); }
.cal-day.other { visibility: hidden; }
.cal-day.today { font-weight: 600; color: var(--primario); }
.cal-day.sel { background: var(--primario); color: #fff; }
.cal-day .dots { display: flex; gap: 2px; height: 5px; }
.cal-day .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--primario); }
.cal-day.sel .dots i { background: #fff; }
.cal-day .n { font-size: 10px; line-height: 1; color: var(--primario); font-weight: 600; }
.cal-day.sel .n { color: #fff; }

.day-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.day-head h2 { font-size: 26px; }
.slots { display: flex; flex-direction: column; }
.slot { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--borde); align-items: flex-start; }
.slot:last-child { border-bottom: 0; }
.slot .hr { font-family: var(--serif); font-size: 18px; width: 52px; flex-shrink: 0; padding-top: 6px; color: var(--secundario); }
.slot .body { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px; align-items: center; }
.slot .add { border: 1px dashed var(--borde); background: none; color: var(--muted); border-radius: 10px; padding: 6px 12px; font-size: 13px; }
.slot .add:hover { border-color: var(--primario); color: var(--primario); }
.slot.free .add { flex: 1; text-align: left; }
.turno {
  border: 0; text-align: left; background: var(--suave); border-left: 3px solid var(--primario);
  border-radius: 10px; padding: 7px 10px; min-width: 0; max-width: 100%; flex: 1 1 200px;
}
.turno .tn { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turno .ts { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turno.realizado { border-left-color: var(--ok); }
.turno.cancelado { border-left-color: var(--bad); opacity: .6; }
.turno.cancelado .tn { text-decoration: line-through; }
.turno.pendiente { border-left-color: var(--info); }

/* ---------- SERVICIOS ---------- */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.svc { background: var(--superficie); border-radius: var(--r); box-shadow: var(--sombra); padding: 16px; display: flex; flex-direction: column; gap: 6px; border: 0; text-align: left; }
.svc h3 { font-size: 22px; }
.svc .desc { font-size: 13.5px; color: var(--muted); flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.svc .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.svc .price { font-family: var(--serif); font-size: 24px; color: var(--primario); font-weight: 600; }

/* ---------- CLIENTAS ---------- */
.cl-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--borde); }
.cl-row:last-child { border-bottom: 0; }
.cl-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primario); flex-shrink: 0; }
.cl-row .main { flex: 1; min-width: 0; cursor: pointer; }
.cl-row .meta { text-align: right; font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.cl-row .meta b { display: block; color: var(--texto); font-weight: 500; font-size: 13px; }
@media (max-width: 520px) { .cl-row .meta { display: none; } }
.selbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--suave); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; }

/* Ficha */
.q { padding: 12px 0; border-bottom: 1px solid var(--borde); }
.q:last-child { border-bottom: 0; }
.q .ql { font-size: 14.5px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--borde); font-size: 13.5px; background: var(--superficie); transition: .15s; cursor: pointer; }
.chip input:checked + span { background: var(--primario); border-color: var(--primario); color: #fff; }
.q .input { padding: 9px 12px; font-size: 15px; }
.sec-title { font-family: var(--serif); font-size: 21px; color: var(--primario); margin: 18px 0 2px; }
.sec-title:first-child { margin-top: 0; }
.alerts { display: flex; flex-wrap: wrap; gap: 6px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.info-grid .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.info-grid .v { font-size: 14.5px; word-break: break-word; }
.sesion { background: var(--fondo); border-radius: 12px; padding: 12px; margin-bottom: 10px; font-size: 14px; }
.sesion .sh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sesion .sh b { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.sesion dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.sesion dt { color: var(--muted); font-size: 12.5px; }
.sesion dd { margin: 0; }

/* Picker de clienta */
.picker { border: 1px solid var(--borde); border-radius: 12px; max-height: 210px; overflow: auto; margin-top: 6px; background: var(--superficie); }
.picker button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--borde); }
.picker button:last-child { border-bottom: 0; }
.picker button:hover, .picker button.on { background: var(--suave); }
.picker .avatar { width: 30px; height: 30px; font-size: 12px; }
.picked { display: flex; align-items: center; gap: 10px; background: var(--suave); border-radius: 12px; padding: 8px 10px; }
.picked .main { flex: 1; }

/* ---------- MARCA ---------- */
.color-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.color-row:last-child { border-bottom: 0; }
.color-row .lbl { flex: 1; }
.color-row .lbl small { display: block; color: var(--muted); font-size: 12px; }
.color-row input[type=color] { width: 44px; height: 44px; border: 0; padding: 0; background: none; border-radius: 12px; cursor: pointer; }
.color-row input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type=color]::-webkit-color-swatch { border: 1px solid var(--borde); border-radius: 12px; }
.color-row .hex { width: 110px; text-transform: uppercase; font-family: ui-monospace, Menlo, monospace; font-size: 15px; padding: 10px; }
.logo-box { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-box .prev { width: 110px; height: 110px; border-radius: 18px; background: var(--fondo); display: grid; place-items: center; padding: 10px; }
.logo-box .prev img { max-height: 100%; object-fit: contain; }
.preview-box { border-radius: var(--r); padding: 18px; background: var(--fondo); border: 1px solid var(--borde); }

/* ---------- MODAL ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(40,34,28,.38);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--superficie); width: 100%; max-width: 560px;
  max-height: calc(100% - 30px - var(--safe-t));
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column;
  animation: slideUp .28s cubic-bezier(.2,.9,.3,1) both;
}
.modal.wide { max-width: 820px; }
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 20px; }
  .modal { border-radius: 22px; max-height: calc(100vh - 40px); }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; border-bottom: 1px solid var(--borde); }
.modal-head h2 { font-size: 25px; }
.modal-body { padding: 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.modal-foot { display: flex; gap: 10px; padding: 12px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--borde); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.modal .tabs { position: sticky; top: -16px; z-index: 2; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--texto); color: var(--fondo); padding: 11px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 500; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- IMPRESIÓN ---------- */
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #222; font-family: var(--sans); font-size: 12px; }
  #print h1 { font-size: 26px; margin-bottom: 4px; }
  #print h2 { font-size: 17px; margin: 14px 0 6px; border-bottom: 1px solid #ccc; padding-bottom: 3px; }
  #print table { width: 100%; border-collapse: collapse; }
  #print td { padding: 3px 6px; vertical-align: top; border-bottom: 1px solid #eee; }
  #print td:first-child { width: 45%; color: #555; }
  #print .ph { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
  #print .ph img { width: 70px; }
  #print .firma { margin-top: 40px; display: flex; justify-content: space-between; }
  #print .firma div { width: 40%; border-top: 1px solid #555; text-align: center; padding-top: 4px; }
}
