/* Reyla — sistema visual. Los colores de marca llegan de /tema.css (variables --brand, --accent, --bg…). */
:root {
  --brand: #8a5a44; --brand-on: #fff; --accent: #c9907a; --accent-on: #1d1917;
  --bg: #f7f3ee; --surface: #fff; --ink: #2b2522;
  --font-brand: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --muted: color-mix(in srgb, var(--ink) 62%, var(--bg));
  --line: color-mix(in srgb, var(--ink) 12%, var(--surface));
  --soft: color-mix(in srgb, var(--brand) 7%, var(--surface));
  --ok: #2f7d4f; --ok-bg: #e8f3ec; --warn: #9a6a00; --warn-bg: #fbf3df; --bad: #b3261e; --bad-bg: #fbe9e7; --info-bg: #eef2f7;
  --r: 10px; --r-sm: 7px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .04);
  --side: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
img { max-width: 100%; }
code { font: 13px ui-monospace, Menlo, Consolas, monospace; background: var(--soft); padding: 1px 5px; border-radius: 4px; }
.ic { flex: none; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 12px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ── Estructura ── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--side); flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; text-decoration: none; color: var(--ink); }
.brand img { max-height: 44px; width: auto; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--brand-on); display: grid; place-items: center; font: 600 17px var(--font-brand); }
.brand-mark.lg { width: 56px; height: 56px; font-size: 26px; }
.brand-name { font: 600 16px var(--font-brand); }
.sidebar nav { padding: 4px 10px 12px; flex: 1; }
.nav-group { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: 14px; width: 100%; }
.nav-link small { display: block; color: var(--muted); font-size: 12px; }
.nav-link:hover { background: var(--soft); }
.nav-link.is-active { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand); font-weight: 600; }
.as-button { background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 10px; }
.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, var(--bg)); position: sticky; top: 0; z-index: 5; }
.page-title { font: 600 20px var(--font-brand); flex: 1; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 24px 28px 48px; max-width: 1240px; width: 100%; }
.icon-btn.only-mobile, .only-mobile { display: none; }
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .3); z-index: 19; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: none; }
  .icon-btn.only-mobile, .only-mobile { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 40px; }
}

/* ── Componentes ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-title { padding: 16px 20px 0; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 14px var(--font); text-decoration: none; cursor: pointer; touch-action: manipulation; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--surface)); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--brand); }
.btn-danger { color: var(--bad); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: 0; color: var(--ink); padding: 6px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; }
.inline-form { display: inline; }

.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
input, select, textarea { width: 100%; font: 15px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; min-height: 42px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand); }
input[type=color] { padding: 3px; height: 42px; }
textarea { min-height: 84px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0; }
legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; }
.input-prefix { position: relative; }
.input-prefix > b { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 400; }
.input-prefix > input { padding-left: 24px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: color-mix(in srgb, var(--soft) 55%, var(--surface)); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--soft) 50%, var(--surface)); }
.table .actions { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 600; border-top: 2px solid var(--line); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--info-bg); color: var(--ink); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-brand { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand); }

.alert { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-info { background: var(--info-bg); }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-value { font: 600 26px var(--font-brand); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.is-key { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-code { font: 600 44px var(--font-brand); color: var(--brand); margin: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }
.search { display: flex; gap: 8px; max-width: 460px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; }
.tabs a.is-active { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border: 0; }
.steps .f { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.steps .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin-right: 6px; border: 1px solid rgb(0 0 0 / .1); }

/* ── Agenda ── */
.agenda { display: grid; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: auto; max-height: 72vh; }
.agenda-head, .agenda-cell { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.agenda-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 10px; font-weight: 600; font-size: 13.5px; }
.agenda-time { position: sticky; left: 0; background: var(--surface); z-index: 1; font-size: 12px; color: var(--muted); padding: 2px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.agenda-col { position: relative; border-right: 1px solid var(--line); }
.agenda-slot { border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.appt { position: absolute; left: 4px; right: 4px; border-radius: 7px; padding: 5px 8px; font-size: 12.5px; overflow: hidden; border-left: 4px solid var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 13%, var(--surface)); color: var(--ink); text-decoration: none; line-height: 1.3; }
.appt b { display: block; font-size: 13px; }
.appt.is-cancelada, .appt.is-no_asistio { opacity: .5; text-decoration: line-through; }
.appt.is-atendida { background: var(--ok-bg); }

/* ── POS ── */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .pos { grid-template-columns: minmax(0, 1fr); } }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.svc { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 12px; cursor: pointer; min-height: 84px; font: inherit; color: var(--ink); touch-action: manipulation; }
.svc:hover, .svc:focus-visible { border-color: var(--brand); }
.svc b { display: block; font-size: 14px; } .svc span { color: var(--muted); font-size: 12.5px; } .svc strong { display: block; margin-top: 6px; font-variant-numeric: tabular-nums; }
.cart { position: sticky; top: 84px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line select { min-height: 34px; padding: 4px 8px; font-size: 13px; }
.cart-line > b { align-self: center; }
.cart-line input { min-height: 36px; padding: 6px 9px; width: 130px; }
.cart-line input[type=number] { width: 72px; }
.cart-line select { width: 100%; }
.cart-total { display: flex; justify-content: space-between; font: 600 22px var(--font-brand); padding: 12px 0; }
.pay-row { display: grid; grid-template-columns: 1fr 120px 32px; gap: 8px; margin-bottom: 8px; }
.pay-row input, .pay-row select { min-height: 38px; }
.suggest { position: relative; }
.suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; }
.suggest-list button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; font: inherit; cursor: pointer; color: var(--ink); }
.suggest-list button:hover, .suggest-list button:focus { background: var(--soft); }

/* ── Acceso e instalación ── */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--accent) 22%, var(--bg)), var(--bg) 60%); }
.guest-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); }
.guest-card.is-wide, .guest-card:has(.req-list) { max-width: 640px; }
.guest-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; }
.guest-brand img { max-height: 72px; width: auto; }
.guest-name { font: 600 20px var(--font-brand); }
.guest-title { font: 600 22px var(--font-brand); text-align: center; margin-bottom: 18px; }
.req-list { margin: 16px 0 22px; display: grid; gap: 6px; }
.req { display: flex; gap: 10px; font-size: 14px; align-items: flex-start; }
.req small { display: block; color: var(--bad); }
.req-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--ok); }
.req.is-bad .req-dot { background: var(--bad); }

/* ── Ticket e impresión ── */
.ticket { font: 13px/1.35 ui-monospace, Menlo, Consolas, monospace; color: #000; background: #fff; margin: 0 auto; padding: 8px; }
.ticket.w80 { width: 72mm; } .ticket.w58 { width: 48mm; font-size: 11px; } .ticket.carta { width: 100%; max-width: 720px; font-family: var(--font); font-size: 14px; }
.ticket h2 { font-size: 1.15em; text-align: center; margin: 4px 0; }
.ticket .c { text-align: center; } .ticket .r { text-align: right; }
.ticket table { width: 100%; border-collapse: collapse; }
.ticket td { padding: 2px 0; vertical-align: top; }
.ticket hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.ticket img { max-width: 60%; display: block; margin: 0 auto 4px; filter: grayscale(1); }
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .alert, .skip { display: none !important; }
  .app, .shell, .content { display: block; padding: 0; margin: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-only { display: block; }
}
.appt[open] { z-index: 4; height: auto; box-shadow: var(--shadow); background: var(--surface); }
.appt summary::-webkit-details-marker { display: none; }
details.card > summary { cursor: pointer; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; overflow-x: auto; padding-top: 8px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 18px; flex: 1; height: 100%; }
.bar span { display: block; width: 100%; max-width: 32px; background: var(--brand); border-radius: 4px 4px 0 0; }
.bar small { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* v1.2: pestañas con botones, notas de línea y certificado imprimible */
.tabs .tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.tabs .tab.is-active { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.cart-line .full { grid-column: 1 / -1; }
.cart-line .line-note { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); margin: -2px 0 0; }
.cart-line .line-note.ok { color: var(--ok); }
.pay-note { font-size: 12.5px; margin: -6px 0 10px; color: var(--muted); }
.pay-note.bad { color: var(--bad); }
.svc[data-add-package] { border-style: dashed; }
.gift { max-width: 640px; margin: 0 auto; border: 2px solid var(--brand); border-radius: 16px; padding: 32px; text-align: center; background: var(--surface); }
.gift h1 { font: 600 30px var(--font-brand); margin: 6px 0 2px; color: var(--brand); }
.gift .amount { font: 600 44px var(--font-brand); margin: 14px 0; }
.gift .code { font: 600 22px ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; padding: 8px 14px; border: 1px dashed var(--line); display: inline-block; border-radius: 8px; }
.gift img { max-height: 70px; max-width: 220px; }
@media print { .no-print { display: none !important; } body.print-page { background: #fff; } .gift { border-color: #999; } }
