/* Panel del dueño. Usa los tokens de style.css. */
body.admin { background: var(--bg); }

/* ───────── Ingreso ───────── */
.login { min-height: 100svh; display: grid; place-items: center; padding: 1.5rem var(--gutter); background: radial-gradient(120% 80% at 80% 0%, rgba(163, 92, 70, .25), transparent 55%), var(--hero-bg); }
.login-card { width: 100%; max-width: 24rem; background: var(--surface); border-radius: var(--radius-lg); padding: 1.75rem 1.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); display: grid; gap: 1rem; }
.login-card h1 { font-family: var(--font-display); font-weight: 500; font-size: 2rem; line-height: 1.05; }
.login-card .sub { color: var(--muted); font-size: .9375rem; margin-top: -.5rem; }
.login-back { text-align: center; font-size: .875rem; }
.login-back a { color: var(--hero-ink); }

/* ───────── Estructura ───────── */
.a-top { background: var(--hero-bg); color: var(--hero-ink); }
.a-top .wrap { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-block: .75rem; }
.a-brand { display: grid; line-height: 1.1; min-width: 0; }
.a-brand .nm { font-family: var(--font-display); font-size: 1.375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-brand .sb { font-size: .6875rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.a-top .acts { display: flex; gap: .5rem; flex: none; }
.a-top .btn-ghost { color: var(--hero-ink); border-color: rgba(245, 240, 232, .3); }
.a-top .btn-ghost:hover { background: rgba(245, 240, 232, .12); color: #fff; }
.a-main { padding-block: 1.25rem 6rem; }
.panel > h2.p-title { font-family: var(--font-display); font-weight: 500; font-size: 1.875rem; line-height: 1.1; margin-bottom: .25rem; }
.panel > .p-sub { color: var(--muted); margin-bottom: 1.25rem; }

.a-nav { position: fixed; z-index: 30; inset: auto 0 0 0; background: var(--surface); border-top: 1px solid var(--line-strong); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.a-nav button { position: relative; display: grid; justify-items: center; align-content: center; gap: .15rem; min-height: 58px; padding: .4rem .1rem; background: none; border: 0; color: var(--muted); font-size: .6875rem; font-weight: 500; }
.a-nav button .ico { width: 22px; height: 22px; }
.a-nav button[aria-current="page"] { color: var(--accent-ink); }
.a-nav button[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--accent-ink); border-radius: 0 0 3px 3px; }
.a-nav .count { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .6875rem; font-weight: 600; display: grid; place-items: center; }

/* ───────── Barra de herramientas ───────── */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.seg { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { min-height: 40px; padding: .4rem .9rem; background: none; border: 0; font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.seg button + button { border-left: 1.5px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--hero-ink); }
.toolbar .grow { flex: 1 1 auto; }
.toolbar .date-in { width: auto; min-height: 40px; }
.date-title { font-family: var(--font-display); font-size: 1.625rem; font-weight: 500; line-height: 1.1; }
.date-title::first-letter { text-transform: uppercase; }
.date-title small { font-family: var(--font-body); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-ink); font-weight: 600; margin-left: .5rem; }
.meta-line { color: var(--muted); font-size: .875rem; margin: .15rem 0 1rem; }

/* ───────── Turnos ───────── */
.ag-list { display: grid; gap: .625rem; }
.tcard { display: grid; grid-template-columns: 4.25rem 1fr; gap: .25rem .875rem; padding: .875rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.tcard.st-pendiente { border-color: #E3C27A; }
.tcard.st-confirmado { border-color: #A9D2BD; }
.tcard.st-cancelado { background: var(--surface-2); }
.tcard.st-cancelado .t-name, .tcard.st-cancelado .t-time strong { text-decoration: line-through; color: var(--muted); }
.t-time { display: grid; align-content: start; line-height: 1.2; font-variant-numeric: tabular-nums; }
.t-time strong { font-size: 1.125rem; }
.t-time span { color: var(--muted); font-size: .8125rem; }
.t-name { font-weight: 600; font-size: 1.0625rem; background: none; border: 0; padding: 0; text-align: left; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; min-height: 28px; }
.t-name:hover { text-decoration-color: var(--accent-ink); }
.t-svc, .t-contact, .t-notes { color: var(--ink-2); font-size: .875rem; }
.t-notes { color: var(--muted); font-style: italic; }
.t-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; margin-top: .25rem; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-pendiente { background: var(--warn-soft); color: #6B4400; }
.b-confirmado { background: var(--ok-soft); color: #1D4D37; }
.b-cancelado { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.group-h { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; color: var(--muted); margin: 1.25rem 0 .5rem; }
.group-h:first-child { margin-top: 0; }

/* semana */
.week { display: grid; gap: .75rem; }
.wday { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .75rem; min-width: 0; }
.wday.is-today { border-color: var(--accent-ink); box-shadow: 0 0 0 1px var(--accent-ink) inset; }
.wday h3 { display: flex; align-items: baseline; gap: .4rem; font-size: .9375rem; text-transform: capitalize; margin-bottom: .5rem; }
.wday h3 .n { font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; line-height: 1; }
.wday .closed { color: var(--muted); font-size: .8125rem; }
.wday ul { display: grid; gap: .375rem; }
.wit { display: grid; grid-template-columns: auto 1fr; gap: .1rem .5rem; width: 100%; text-align: left; padding: .45rem .55rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); font-size: .8125rem; min-height: 44px; }
.wit:hover { background: var(--accent-soft); }
.wit.st-pendiente { background: var(--warn-soft); border-color: #E3C27A; }
.wit.st-confirmado { background: var(--ok-soft); border-color: #A9D2BD; }
.wit.st-cancelado { opacity: .7; text-decoration: line-through; }
.wit .tm { font-weight: 600; font-variant-numeric: tabular-nums; }
.wit .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wit .sv { grid-column: 1 / -1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────── Listas editables (servicios, bloqueos) ───────── */
.rows { display: grid; gap: .625rem; }
.row-card { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center; padding: .875rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.row-card.is-off { background: var(--surface-2); }
.row-card .rt { font-weight: 600; }
.row-card .rs { color: var(--muted); font-size: .875rem; }
.row-card .ra { display: flex; flex-wrap: wrap; gap: .375rem; justify-content: flex-end; }
.tag-off { display: inline-block; margin-left: .5rem; padding: .05rem .5rem; font-size: .6875rem; font-weight: 600; background: var(--line); color: var(--ink-2); border-radius: 99px; vertical-align: .1em; }

/* ───────── Horarios semanales ───────── */
.wk-day { display: grid; gap: .5rem; padding: .875rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.wk-day + .wk-day { margin-top: .5rem; }
.wk-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.wk-head .check { min-height: 40px; font-weight: 600; }
.wk-ranges { display: grid; gap: .5rem; }
.wk-range { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.wk-range .input { width: auto; min-width: 7.25rem; }
.wk-range .sep { color: var(--muted); }
.wk-closed { color: var(--muted); font-size: .875rem; }
.section-h { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; margin: 2rem 0 .5rem; line-height: 1.1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem; }
.form-row { display: grid; gap: .875rem; }
.form-row.two { grid-template-columns: 1fr 1fr; }
.save-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1rem; }
.saved { color: var(--ok); font-size: .875rem; font-weight: 500; }

/* ───────── Clientes ───────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.tbl { width: 100%; border-collapse: collapse; min-width: 34rem; font-size: .9rem; }
.tbl th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: .65rem .875rem; border-bottom: 1px solid var(--line-strong); background: var(--surface-2); }
.tbl td { padding: .65rem .875rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { font-variant-numeric: tabular-nums; }
.cli-acts { display: flex; gap: .375rem; }

/* ───────── Ventana de diálogo ───────── */
dialog { border: 0; padding: 0; border-radius: var(--radius-lg); width: min(36rem, calc(100vw - 1.5rem)); max-height: calc(100svh - 1.5rem); color: var(--ink); background: var(--surface); box-shadow: 0 24px 80px rgba(0, 0, 0, .35); }
dialog::backdrop { background: rgba(26, 23, 20, .55); }
.dlg-in { display: flex; flex-direction: column; max-height: calc(100svh - 1.5rem); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; line-height: 1.1; }
.dlg-body { padding: 1.25rem; overflow-y: auto; display: grid; gap: 1rem; }
.dlg-foot { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; padding: 1rem 1.25rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.kv { display: grid; gap: .4rem; }
.kv div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--line); padding-bottom: .4rem; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 500; text-align: right; }
.slot-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr)); gap: .4rem; }
.slot-chips .slot span { min-height: 40px; font-size: .9rem; }

/* ───────── Aviso flotante ───────── */
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(4.75rem + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); max-width: min(30rem, calc(100vw - 1.5rem)); display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; background: var(--ink); color: var(--hero-ink); border-radius: var(--radius-lg); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; font-size: .9375rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.is-error { background: #7D1B13; }
.toast a, .toast button { color: var(--gold); font-weight: 600; background: none; border: 0; padding: 0; text-decoration: underline; white-space: nowrap; min-height: 32px; }

@media (min-width: 768px) {
  .a-nav { position: static; display: flex; gap: .25rem; border: 0; background: none; max-width: 1080px; margin: 1rem auto 0; padding: 0 var(--gutter); border-bottom: 1px solid var(--line-strong); }
  .a-nav button { grid-auto-flow: column; display: inline-flex; gap: .5rem; padding: .6rem 1rem; min-height: 46px; font-size: .9375rem; border-radius: var(--radius) var(--radius) 0 0; }
  .a-nav button .ico { width: 20px; height: 20px; }
  .a-nav button[aria-current="page"] { background: var(--surface); box-shadow: 0 -1px 0 var(--line-strong) inset, 1px 0 0 var(--line-strong) inset, -1px 0 0 var(--line-strong) inset; }
  .a-nav button[aria-current="page"]::before { left: 0; right: 0; border-radius: 0; }
  .a-nav .count { position: static; }
  .a-main { padding-bottom: 3rem; }
  .toast { bottom: 1.5rem; }
  .tcard { grid-template-columns: 4.5rem 1fr auto; align-items: start; }
  .t-actions { grid-column: auto; margin: 0; padding: 0; border: 0; justify-content: flex-end; max-width: 22rem; }
  .form-row.two-d { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1000px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
  .wday { padding: .625rem; }
}
@media (max-width: 480px) {
  .form-row.two { grid-template-columns: 1fr; }
}
