/* Peluquería · estilos. Sin librerías externas: funciona sin internet. */
:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1d2422;
  --ink-2: #4a5552;
  --muted: #6a7471;
  --line: #e3ded4;
  --line-2: #d2ccc0;
  --primary: #0f6b63;
  --primary-ink: #ffffff;
  --primary-soft: #e2f1ee;
  --primary-hover: #0b5751;
  --titular: #0f6b63;
  --titular-soft: #e2f1ee;
  --ayudante: #6a3fb5;
  --ayudante-soft: #efe8fa;
  --ok: #1f7a3a;
  --ok-soft: #e4f3e8;
  --warn: #a14d00;
  --warn-soft: #fff0dc;
  --warn-line: #f0b36b;
  --bad: #b3261e;
  --bad-soft: #fde8e6;
  --cat: #8a4b10;
  --cat-soft: #fbeedd;
  --dog: #245c8a;
  --dog-soft: #e3eef8;
  --wa: #128c4a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(29, 36, 34, 0.06), 0 4px 14px rgba(29, 36, 34, 0.06);
  --gutter: 16px;
  --tap: 48px;
  font-size: 17px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; display: flex; align-items: center; gap: 0.45em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.6em; }
a { color: var(--primary); }
code { font: 0.85em ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 6px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.i { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.ico { display: inline-flex; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.92rem; margin: 0.25em 0 0.5em; }
.hint.small { font-size: 0.82rem; }
.center { text-align: center; justify-content: center; }
.lead { font-size: 1.08rem; color: var(--ink-2); }
.pre { white-space: pre-wrap; }
.big { font-size: 1.15rem; }
.loading { color: var(--muted); padding: 2rem 0; text-align: center; }
:focus-visible { outline: 3px solid #f2a93b; outline-offset: 2px; }

/* --- Barra superior y pestañas ------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.15rem; margin-right: auto; }
.brand img { border-radius: 10px; }
.tabs { display: flex; gap: 6px; }
.tabs a, .settings-link {
  display: flex; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px;
  border-radius: 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 1.02rem;
}
.tabs a:hover, .settings-link:hover { background: var(--surface-2); color: var(--ink); }
.tabs a.on { background: var(--primary); color: var(--primary-ink); }
.settings-link { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 0.95rem; padding: 0 12px; }
.settings-link.on { background: var(--primary-soft); color: var(--primary); }
.mode-banner { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn-line); text-align: center; padding: 8px var(--gutter); font-weight: 600; }

main { max-width: 1180px; margin: 0 auto; padding: 22px var(--gutter) 110px; outline: none; }
.page-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1, .section-head h2 { margin: 0; }
section + section { margin-top: 26px; }

/* --- Tarjetas -------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }

/* --- Botones --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
  -webkit-user-select: none; user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: #bdb6a8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #18642f; }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: #0d733c; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #941f18; }
.btn-danger-soft { color: var(--bad); border-color: #efc2bd; background: #fff; }
.btn-danger-soft:hover { background: var(--bad-soft); border-color: #e6a39c; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: #d1e9e4; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-link { background: none; border: 0; color: var(--primary); padding: 0; min-height: 40px; }
.btn-small { min-height: 40px; padding: 0 12px; font-size: 0.92rem; border-radius: 10px; }
.btn-lg { min-height: 54px; padding: 0 22px; font-size: 1.05rem; }
.btn-xl { min-height: 64px; padding: 0 26px; font-size: 1.15rem; border-radius: 16px; }
.btn-icon, .btn-icon-lg { display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; cursor: pointer; color: var(--ink-2); border-radius: 10px; }
.btn-icon { width: 44px; height: 44px; }
.btn-icon:hover { background: var(--surface-2); }
.btn-icon-lg { width: var(--tap); height: var(--tap); padding: 0; border: 1px solid var(--line-2); background: var(--surface); }
.btn-step { min-width: 108px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.actions.wrap { flex-wrap: wrap; }
.actions .btn { flex: 0 0 auto; }

/* Selector segmentado */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; }
.seg-btn:hover:not(:disabled) { background: #fff; }
.seg-btn.on { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.seg-btn.on.persona-ayudante { background: var(--ayudante); }
.seg-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.seg-xl .seg-btn { min-height: 60px; padding: 0 28px; font-size: 1.15rem; }

/* Contador de minutos */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper-value { min-width: 140px; text-align: center; font-size: 1.35rem; font-weight: 700; }
.stepper-xl .stepper-value { font-size: 2.2rem; min-width: 210px; }
.stepper-xl .btn-step { min-height: 64px; font-size: 1.1rem; min-width: 130px; }

/* --- Formularios ----------------------------------------------------------------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
label, .label { font-weight: 600; color: var(--ink-2); font-size: 0.95rem; }
input, select, textarea {
  font: inherit; color: var(--ink);
  min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: #fff;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
textarea { resize: vertical; min-height: 72px; }
select[size] { min-height: 160px; padding: 4px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid rgba(15, 107, 99, 0.18); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 0.9rem; margin: 0; font-weight: 600; }
.input-xl { font-size: 1.25rem; min-height: 60px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
fieldset { min-width: 0; }
fieldset.block { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; display: grid; gap: 12px; background: var(--surface-2); }
fieldset.block legend { font-weight: 700; padding: 0 6px; display: flex; align-items: center; gap: 6px; color: var(--ink); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); cursor: pointer; min-height: 40px; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--primary); flex: none; }
.error-box { background: var(--bad-soft); color: var(--bad); border: 1px solid #efc2bd; border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 600; }
.search { position: relative; display: flex; align-items: center; }
.search .i { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 44px; }
.search-xl input { min-height: 60px; font-size: 1.2rem; border-radius: 14px; }
.search-xl .i { width: 1.5em; height: 1.5em; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.day-check { display: inline-flex; }
.day-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-check span { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; min-height: 46px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600; }
.day-check input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.day-check input:focus-visible + span { outline: 3px solid #f2a93b; }

/* --- Avisos ---------------------------------------------------------------------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); margin: 0 0 14px; color: var(--ink); text-align: left; width: 100%; font: inherit; }
.notice > .i { margin-top: 2px; color: var(--primary); }
.notice-warn { background: var(--warn-soft); border-color: var(--warn-line); }
.notice-warn > .i { color: var(--warn); }
.notice-bad { background: var(--bad-soft); border-color: #efc2bd; }
.notice-bad > .i { color: var(--bad); }
.notice.as-link { text-decoration: none; cursor: pointer; }
.notice.as-link:hover { filter: brightness(0.98); }
.notice .actions { margin-top: 10px; flex-wrap: wrap; }
ul.plain { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
ul.plain li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; margin: 0; }
.badge .i { width: 1em; height: 1em; }
.b-ok, .estado-realizada.badge { background: var(--ok-soft); color: var(--ok); border-color: #bfe0c8; }
.b-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.b-bad { background: var(--bad-soft); color: var(--bad); border-color: #efc2bd; }
.b-muted { background: var(--surface-2); color: var(--muted); }
.b-next { background: var(--primary); color: #fff; border-color: var(--primary); }
.estado-programada.badge { background: var(--primary-soft); color: var(--primary); border-color: #bfded8; }
.estado-cancelada.badge { background: #eeeae3; color: #5c625f; }
.badge.persona-titular { background: var(--titular-soft); color: var(--titular); border-color: #bfded8; }
.badge.persona-ayudante { background: var(--ayudante-soft); color: var(--ayudante); border-color: #d6c7f0; }
.badge.is-dog { background: var(--dog-soft); color: var(--dog); border-color: #c3d8ec; }
.badge.is-cat { background: var(--cat-soft); color: var(--cat); border-color: #edd3b2; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Avisos breves */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(560px, calc(100% - 32px)); pointer-events: none; }
.toast { background: #1d2422; color: #fff; padding: 14px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: opacity .4s, transform .4s; }
.toast-bad { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* --- Ventanas ---------------------------------------------------------------------- */
dialog.modal { overflow-x: hidden; border: 0; border-radius: 18px; padding: 0; width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); background: var(--surface); }
dialog.modal-wide { width: min(780px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(20, 26, 25, 0.45); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.modal-body { padding: 18px 20px 22px; }
.sticky-actions { position: sticky; bottom: -22px; background: linear-gradient(to top, var(--surface) 78%, rgba(255,255,255,0)); padding: 14px 0 6px; margin-bottom: -6px; }

/* Selector de cliente */
.picker-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.picker-list .empty { color: var(--muted); padding: 8px 2px; }
.pick { width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; text-align: left; min-height: var(--tap); padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer; }
.pick:hover { border-color: var(--primary); background: var(--primary-soft); }
.pick span { color: var(--muted); font-size: 0.92rem; }
.chosen { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.chosen .hint { display: block; margin: 2px 0 0; }
.pet-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.pet-choice { display: inline-flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 14px 6px 6px; border: 2px solid var(--line); border-radius: 14px; background: #fff; font: inherit; cursor: pointer; text-align: left; }
.pet-choice span { display: grid; }
.pet-choice small { color: var(--muted); }
.pet-choice.on { border-color: var(--primary); background: var(--primary-soft); }
.pet-choice.add { color: var(--primary); font-weight: 600; padding-left: 14px; border-style: dashed; }
.inline-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.inline-add input { flex: 1 1 180px; width: auto; }
.price-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.price-line .label { display: block; }
.price-line .price { font-size: 1.6rem; }
.new-client { display: grid; gap: 12px; }

/* Miniaturas */
.thumb { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.thumb-lg { width: 76px; height: 76px; }
.thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--dog); background: var(--dog-soft); }
.thumb-empty.is-cat { color: var(--cat); background: var(--cat-soft); }
.thumb-empty .i { width: 55%; height: 55%; }

/* --- Inicio ------------------------------------------------------------------------- */
.home-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.home-head h1 { font-size: 2rem; margin-bottom: 4px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; font-weight: 700; color: var(--primary); margin: 0; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.home-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.home-cols .card + .card { margin-top: 0; }
.appt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.appt-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 14px; min-height: 64px; border: 1px solid var(--line); border-left: 5px solid var(--titular); border-radius: 12px; background: #fff; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.appt-row:hover { border-color: var(--primary); border-left-color: var(--titular); background: var(--surface-2); }
.appt-row.persona-ayudante { border-left-color: var(--ayudante); }
.appt-row .hour { display: grid; font-weight: 750; font-size: 1.2rem; min-width: 64px; font-variant-numeric: tabular-nums; }
.appt-row .hour small { font-weight: 500; font-size: 0.78rem; color: var(--muted); }
.appt-row .who { display: grid; flex: 1; min-width: 0; }
.appt-row .who span { color: var(--ink-2); }
.appt-row .who small { color: var(--muted); }
.appt-row .state { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.appt-row.is-next { box-shadow: 0 0 0 2px var(--primary) inset; }
.appt-row.estado-realizada { opacity: 0.75; }
.appt-row.estado-cancelada { opacity: 0.6; text-decoration: line-through; border-left-color: #b9b3a8; }
.empty-state { display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); padding: 22px 8px; list-style: none; }
.empty-state > .i { width: 40px; height: 40px; color: #b9b3a8; }
.regulars { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.regulars li { display: flex; align-items: center; gap: 10px; }
.regular { flex: 1; display: grid; text-decoration: none; color: var(--ink); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-width: 0; }
.regular:hover { border-color: var(--primary); }
.regular span { color: var(--ink-2); font-size: 0.95rem; }
.regular small { color: var(--muted); }

/* --- Agenda --------------------------------------------------------------------------- */
.agenda-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.date-nav { display: flex; align-items: center; gap: 10px; }
.agenda-title { font-size: 1.45rem; margin: 0; min-width: 0; }
.agenda-title::first-letter { text-transform: uppercase; }
.agenda-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.date-pick { position: relative; overflow: hidden; }
.date-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.day-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.day-summary .sep { width: 1px; height: 22px; background: var(--line); }
.day-summary .btn { margin-left: auto; }

.day-grid { display: grid; grid-template-columns: 58px repeat(var(--cols, 1), minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.day-grid > .col-head:first-child { border-top-left-radius: var(--radius); }
.day-grid.cols-1 > .col-head:nth-child(2), .day-grid.cols-2 > .col-head:nth-child(3) { border-top-right-radius: var(--radius); }
.day-grid.cols-1 { --cols: 1; }
.day-grid.cols-2 { --cols: 2; }
.col-head { position: sticky; top: var(--topbar-h, 69px); z-index: 5; padding: 10px 12px; font-weight: 700; background: var(--surface); border-bottom: 1px solid var(--line); text-align: center; }
.col-head.persona-titular { color: var(--titular); box-shadow: inset 0 -3px 0 var(--titular); }
.col-head.persona-ayudante { color: var(--ayudante); box-shadow: inset 0 -3px 0 var(--ayudante); }
.times, .col { position: relative; height: var(--alto); }
.times { border-right: 1px solid var(--line); }
.times .t { position: absolute; right: 8px; transform: translateY(-50%); font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.times .t:first-child { transform: none; }
.col + .col { border-left: 1px solid var(--line); }
.col { cursor: copy; }
.col-ayudante { background: repeating-linear-gradient(135deg, #f3f1ec 0 8px, #ebe8e1 8px 16px); }
.col-ayudante .avail { position: absolute; left: 0; right: 0; background: #fff; }
.col .line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.col .line.half { border-top-style: dashed; border-top-color: #ece8e0; }
.col .now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); z-index: 3; pointer-events: none; }
.col .now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.slot-hint { position: absolute; left: 6px; right: 6px; border: 2px dashed var(--primary); border-radius: 10px; background: rgba(226, 241, 238, 0.7); color: var(--primary); font-weight: 700; display: flex; align-items: flex-start; padding: 6px 10px; pointer-events: none; z-index: 1; font: inherit; font-weight: 700; }
.appt {
  position: absolute; left: 6px; right: 6px; z-index: 2;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; overflow: hidden;
  padding: 6px 10px; border: 1px solid #bfded8; border-left: 5px solid var(--titular); border-radius: 10px;
  background: var(--titular-soft); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.appt:hover { filter: brightness(0.97); box-shadow: var(--shadow); }
.appt.persona-ayudante { background: var(--ayudante-soft); border-color: #d6c7f0; border-left-color: var(--ayudante); }
.appt.estado-realizada { background: #f1f4f2; border-color: #d4dcd7; border-left-color: var(--ok); color: var(--ink-2); }
.appt.is-warn { background: var(--warn-soft); border-color: var(--warn-line); border-left-color: var(--warn); }
.appt-time { font-weight: 700; font-size: 0.88rem; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 4px; }
.appt-time .i { color: var(--ok); }
.appt-main { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.appt-main .thumb { width: 26px; height: 26px; }
.appt-main strong { white-space: nowrap; }
.appt-client, .appt-sub { color: var(--ink-2); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.appt-flags { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; }
.flag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 8px; font-size: 0.78rem; font-weight: 700; border: 1px solid transparent; }
.flag .i { width: 0.95em; height: 0.95em; }
.flag.persona-ayudante { background: var(--ayudante-soft); color: var(--ayudante); }
.appt.is-short { flex-direction: row; align-items: center; gap: 8px; padding-top: 2px; padding-bottom: 2px; }
.appt.is-short .appt-sub { display: none; }
.appt.is-short .appt-main .thumb { display: none; }
.gblock { position: absolute; left: 6px; right: 6px; z-index: 2; display: flex; align-items: flex-start; gap: 6px; padding: 6px 10px; border: 1px dashed #9a948a; border-radius: 10px; background: repeating-linear-gradient(135deg, #f0ede7 0 6px, #e6e2da 6px 12px); color: var(--ink-2); font: inherit; font-size: 0.88rem; font-weight: 600; text-align: left; cursor: pointer; overflow: hidden; }
details.cancelled { margin-top: 16px; }
details.cancelled summary { cursor: pointer; color: var(--muted); font-weight: 600; min-height: 40px; display: flex; align-items: center; }
details.cancelled .appt-list { margin-top: 8px; }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: grid; align-content: start; gap: 8px; min-height: 200px; margin: 0 !important; }
.week-day.is-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.week-day.is-closed { background: var(--surface-2); }
.week-head { display: grid; gap: 2px; border: 0; background: none; font: inherit; text-align: left; padding: 6px; border-radius: 10px; cursor: pointer; color: inherit; }
.week-head:hover { background: var(--surface-2); }
.week-head .wd { font-weight: 700; font-size: 1.05rem; text-transform: capitalize; }
.week-head .count { color: var(--muted); font-size: 0.88rem; }
.week-head .flag { justify-self: start; }
.week-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.week-appt { width: 100%; display: grid; gap: 1px; text-align: left; padding: 6px 8px; border: 1px solid #bfded8; border-left: 4px solid var(--titular); border-radius: 8px; background: var(--titular-soft); font: inherit; cursor: pointer; color: inherit; }
.week-appt.persona-ayudante { background: var(--ayudante-soft); border-color: #d6c7f0; border-left-color: var(--ayudante); }
.week-appt.estado-realizada { background: #f1f4f2; border-color: #d4dcd7; border-left-color: var(--ok); }
.week-appt.is-warn { background: var(--warn-soft); border-color: var(--warn-line); border-left-color: var(--warn); }
.week-appt .hour { font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.week-appt .who { font-size: 0.92rem; line-height: 1.25; overflow: hidden; }
.week-appt .who small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.shift-list { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 10px; }
.shift-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.shift-row label { display: flex; align-items: center; gap: 8px; }
.shift-row select { width: auto; min-width: 110px; }
.shift-list .empty { color: var(--muted); padding: 8px 2px; }

/* Ficha de cita */
.appt-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.appt-head .when { margin: 0; color: var(--ink-2); font-weight: 600; }
.appt-head .when::first-letter { text-transform: uppercase; }
.appt-head .time { font-size: 1.6rem; font-weight: 750; margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.appt-head .time small { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.facts { margin: 0 0 6px; display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.facts > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 14px; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }

/* --- Calculadora ------------------------------------------------------------------------ */
.calc { max-width: 760px; margin: 0 auto; }
.calc-card { display: grid; gap: 22px; padding: 26px; }
.calc-row { display: grid; gap: 10px; justify-items: center; text-align: center; }
.calc-row .input-xl { max-width: 420px; text-align: center; }
.calc-total { display: grid; justify-items: center; gap: 2px; padding: 18px; background: var(--primary-soft); border-radius: var(--radius); }
.calc-total strong { font-size: 3.4rem; line-height: 1.1; color: var(--primary); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* --- Clientes ----------------------------------------------------------------------------- */
.client-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.client-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; min-height: 70px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-decoration: none; color: var(--ink); }
.client-row:hover { border-color: var(--primary); }
.client-row .pets { display: flex; }
.client-row .pets .thumb { width: 46px; height: 46px; border: 2px solid #fff; }
.client-row .pets .thumb + .thumb { margin-left: -14px; }
.client-row .who { display: grid; flex: 1; min-width: 0; }
.client-row .who strong { font-size: 1.1rem; }
.client-row .who span { color: var(--ink-2); }
.client-row .who small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; margin-bottom: 10px; min-height: 40px; }
.ficha-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.ficha-head h1 { margin-bottom: 6px; }
.contact { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 1.05rem; }
.contact span { display: inline-flex; align-items: center; gap: 6px; }
.note { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.ficha-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.pets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pet-card { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 14px; margin: 0 !important; }
.pet-photo { position: relative; display: grid; gap: 8px; justify-items: center; }
.pet-photo img, .pet-photo .thumb-empty { width: 120px; height: 120px; border-radius: 14px; object-fit: cover; }
.photo-btn { cursor: pointer; white-space: nowrap; }
.pet-info h3 { margin-bottom: 4px; }
.pet-info .actions { margin-top: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.history { width: 100%; border-collapse: collapse; min-width: 520px; }
.history th, .history td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.history th { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); }
.history tbody tr { cursor: pointer; }
.history tbody tr:hover { background: var(--surface-2); }
.history tr:last-child td { border-bottom: 0; }
.history td small { color: var(--muted); }
.history .num { text-align: right; font-variant-numeric: tabular-nums; }
.history tr.estado-cancelada td:not(:nth-child(4)) { color: var(--muted); text-decoration: line-through; }
.danger-zone { margin-top: 28px; padding-top: 16px; border-top: 1px dashed var(--line-2); }

/* --- Ajustes -------------------------------------------------------------------------------- */
.settings { max-width: 860px; }
.settings .card { margin-top: 18px; }
.tariffs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stats { margin: 8px 0; }
.backup-list { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 8px; }
.backup-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.backup-list .actions { margin: 0; }
.backup-list small { color: var(--muted); margin-left: 6px; }

/* --- Hoja de presupuesto (solo al imprimir) ---------------------------------------------- */
.print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 22mm; }
  body { background: #fff; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block !important; color: #000; }
  .sheet header { display: flex; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 30px; font-size: 13pt; }
  .sheet-brand { font-weight: 700; margin: 0; }
  .sheet-date { margin: 0; }
  .sheet h1 { font-size: 24pt; margin: 0 0 24px; }
  .sheet table { width: 100%; border-collapse: collapse; font-size: 14pt; }
  .sheet th, .sheet td { text-align: left; padding: 12px 0; border-bottom: 1px solid #999; }
  .sheet th { width: 40%; font-weight: 600; }
  .sheet .total th, .sheet .total td { font-size: 20pt; font-weight: 800; border-bottom: 0; padding-top: 22px; }
}

/* --- Ventanas estrechas ------------------------------------------------------------------- */
@media (max-width: 980px) {
  .home-cols { grid-template-columns: 1fr; }
  .home-cols .card + .card { margin-top: 0; }
  .week { grid-template-columns: 1fr; }
  .week-day { min-height: 0; grid-template-columns: 150px 1fr; align-items: start; }
  .week-day > .btn { grid-column: 2; justify-self: start; }
}
@media (max-width: 760px) {
  :root { font-size: 16px; }
  .topbar { padding: 8px var(--gutter); }
  .brand span { display: none; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabs a { flex-direction: column; gap: 2px; padding: 6px 4px; min-height: 58px; font-size: 0.78rem; flex: 1; justify-content: center; border-radius: 12px; }
  .tabs a .i { width: 1.6em; height: 1.6em; }
  .settings-link .settings-text { display: inline; }
  main { padding-top: 16px; padding-bottom: 120px; }
  h1, .home-head h1 { font-size: 1.5rem; }
  .grid-2, .grid-3, .tariffs { grid-template-columns: minmax(0, 1fr); }
  .agenda-bar { flex-direction: column; align-items: stretch; }
  .date-nav { justify-content: space-between; }
  .agenda-title { font-size: 1.15rem; text-align: center; flex: 1; }
  .agenda-tools { justify-content: space-between; }
  .agenda-tools .btn-primary { flex: 1 1 100%; }
  .date-pick span { display: none; }
  .day-grid { grid-template-columns: 46px repeat(var(--cols, 1), minmax(0, 1fr)); }
  .appt { left: 3px; right: 3px; padding: 4px 6px; }
  .appt-main .thumb { display: none; }
  .appt-flags { display: none; }
  .appt-client { display: none; }
  .day-summary .btn { margin-left: 0; }
  .day-summary .sep { display: none; }
  .week-day { grid-template-columns: 1fr; }
  .week-day > .btn { grid-column: 1; }
  .stepper-xl .btn-step { min-width: 96px; }
  .stepper-xl .stepper-value { min-width: 0; font-size: 1.7rem; flex: 1; }
  .stepper { justify-content: space-between; width: 100%; }
  .stepper .btn-step { min-width: 0; padding: 0 14px; }
  .stepper .stepper-value { min-width: 0; flex: 1; }
  .calc-card { padding: 18px; }
  .calc-total strong { font-size: 2.8rem; }
  .seg-xl { width: 100%; }
  .seg-xl .seg-btn { flex: 1; justify-content: center; padding: 0 12px; }
  .pets-grid { grid-template-columns: 1fr; }
  .pet-card { grid-template-columns: 110px 1fr; }
  .pet-photo img, .pet-photo .thumb-empty { width: 110px; height: 110px; }
  .facts > div { grid-template-columns: 1fr; gap: 2px; }
  .appt-row .state { display: none; }
  .ficha-actions { width: 100%; }
  .home-actions { width: 100%; }
  .home-actions .btn { flex: 1; padding: 0 12px; font-size: 1.05rem; white-space: nowrap; }
  .actions:not(.wrap) { flex-wrap: wrap; }
  .actions:not(.wrap) .btn-lg { flex: 1 1 auto; }
  dialog.modal, dialog.modal-wide { width: 100%; max-width: 100%; max-height: 100%; height: 100%; margin: 0; border-radius: 0; }
  .toasts { bottom: 90px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* --- Toque «cristal»: fondo suave y superficies translúcidas. El desenfoque va solo en
   unas pocas piezas grandes para que Safari no se ralentice. --------------------------- */
body {
  background:
    radial-gradient(1100px 560px at 8% -12%, #cfeee6 0%, rgba(207, 238, 230, 0) 62%),
    radial-gradient(900px 520px at 102% -4%, #e9e0fb 0%, rgba(233, 224, 251, 0) 58%),
    linear-gradient(180deg, #f2f6f5 0%, #eef0f3 100%);
  background-attachment: fixed;
}
.topbar, dialog.modal, .card, .day-grid {
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
}
.topbar { background: rgba(255, 255, 255, 0.6); border-bottom-color: rgba(255, 255, 255, 0.75); box-shadow: 0 1px 0 rgba(15, 107, 99, 0.06); }
.card, .day-grid, .day-summary, .week-day, .table-wrap {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 30px rgba(31, 52, 48, 0.08);
}
.col-head { background: rgba(255, 255, 255, 0.78); }
.col-ayudante .avail { background: rgba(255, 255, 255, 0.72); }
.appt-row, .client-row, .regular, .chosen, .price-line, .pick, .pet-choice, .notice, .backup-list li, .shift-row, fieldset.block {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(31, 52, 48, 0.05);
}
.notice-warn { background: rgba(255, 240, 220, 0.85); border-color: var(--warn-line); }
.notice-bad { background: rgba(253, 232, 230, 0.9); border-color: #efc2bd; }
.btn { background: rgba(255, 255, 255, 0.72); border-color: rgba(29, 36, 34, 0.12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(31, 52, 48, 0.06); }
.btn:hover { background: rgba(255, 255, 255, 0.92); }
.btn-primary, .tabs a.on, .seg-btn.on { background: linear-gradient(180deg, #16857a 0%, #0f6b63 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(15, 107, 99, 0.28); }
.btn-primary:hover { background: linear-gradient(180deg, #13786f 0%, #0b5751 100%); }
.btn-ok { background: linear-gradient(180deg, #25914a, #1f7a3a); }
.btn-wa { background: linear-gradient(180deg, #17a359, #128c4a); }
.btn-soft { background: rgba(226, 241, 238, 0.85); }
.seg { background: rgba(255, 255, 255, 0.5); border-color: rgba(255, 255, 255, 0.9); }
input, select, textarea { background: rgba(255, 255, 255, 0.85); }
.calc-total { background: linear-gradient(135deg, rgba(226, 241, 238, 0.9), rgba(239, 232, 250, 0.75)); border: 1px solid rgba(255, 255, 255, 0.9); }
dialog.modal { background: rgba(255, 255, 255, 0.84); border: 1px solid rgba(255, 255, 255, 0.9); }
.modal-head { background: rgba(255, 255, 255, 0.7); }
dialog::backdrop { background: rgba(20, 26, 25, 0.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (max-width: 760px) {
  .tabs { background: rgba(255, 255, 255, 0.68); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); }
}
@media print { body { background: #fff; } }
