body { background: var(--bg); }
.shell { max-width: 760px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(170px + env(safe-area-inset-bottom)); }

.topbar { display: flex; align-items: center; gap: 12px; padding: 4px 0 18px; }
.topbar .mark { width: 42px; height: 42px; border-radius: 12px; flex: none; }
.topbar .who { flex: 1; min-width: 0; }
.topbar .who small { display: block; color: var(--ink-3); font-size: .82rem; }
.topbar .who strong { display: block; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar a { font-weight: 700; color: var(--brand); text-decoration: none; font-size: .95rem; white-space: nowrap; }

h1.view-title { font-size: 2rem; letter-spacing: -.03em; line-height: 1.05; margin: 0; font-weight: 800; }
.view-sub { color: var(--ink-2); margin: 6px 0 18px; }
.cat-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 10px; }
.cat-title h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.015em; }
.link-btn { color: var(--brand); font-weight: 700; font-size: .92rem; }

.panel { background: var(--cal); border-radius: var(--radius-m); padding: 4px 14px; }
.panel.pad { padding: 18px; }
.panel + .panel { margin-top: 14px; }
.panel h2 { margin: 0 0 4px; font-size: 1.2rem; letter-spacing: -.015em; }

.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .tap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; }
.row .thumb { width: 54px; height: 54px; border-radius: 12px; overflow: hidden; background: var(--tint); display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 68%; }
.row .txt { min-width: 0; }
.row .txt strong { display: block; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .txt small { color: var(--ink-3); font-size: .85rem; }
.row.off .thumb, .row.off .txt { opacity: .45; }
.row .warn { color: #9A6A00; }
.state { font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.state.off { background: color-mix(in srgb, var(--danger) 14%, var(--cal)); color: var(--danger); }

/* Interruptor grande */
.switch { position: relative; width: 58px; height: 34px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .25); transition: transform .2s; }
.switch input:checked + span { background: var(--hoja); }
.switch input:checked + span::after { transform: translateX(24px); }
.switch input:focus-visible + span { outline: 3px solid var(--albero); outline-offset: 2px; }

.search-admin { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; background: var(--cal); border-radius: 14px; border: 1px solid var(--line); }
.search-admin input { flex: 1; border: 0; outline: 0; background: transparent; }

.fab {
  position: fixed; right: max(16px, calc(50% - 364px)); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 25;
  height: 56px; padding: 0 22px; border-radius: 18px; background: var(--brand); color: #fff; font-weight: 700; font-size: 1rem;
  box-shadow: var(--shadow-float);
}

/* Navegación inferior */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--cal) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar nav { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); }
.tabbar button { height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .75rem; font-weight: 600; color: var(--ink-3); }
.tabbar button .i { font-size: 1.35rem; line-height: 1; filter: grayscale(1); opacity: .7; position: relative; }
.tabbar button[aria-current="page"] { color: var(--ink); }
.tabbar button[aria-current="page"] .i { filter: none; opacity: 1; }

/* Formularios */
.field { display: block; margin-top: 14px; }
.field > span { display: block; font-weight: 650; font-size: .92rem; margin-bottom: 6px; }
.field small { display: block; color: var(--ink-3); font-size: .82rem; margin-top: 5px; }
.input, textarea.input, select.input {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); outline: 0; font-size: 1rem;
}
textarea.input { min-height: 88px; resize: vertical; line-height: 1.4; }
.input:focus { border-color: var(--brand); background: var(--cal); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .input { flex: 1; }
.price-row { display: grid; grid-template-columns: 1.3fr 1fr 44px; gap: 8px; margin-top: 8px; }
.del-x { width: 44px; height: 48px; border-radius: 12px; background: var(--bg); color: var(--ink-3); font-size: 1.1rem; }
.grid-toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tgl { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-weight: 600; font-size: .92rem; border: 2px solid transparent; text-align: left; line-height: 1.15; }
.tgl[aria-pressed="true"] { border-color: var(--brand); background: var(--tint); }
.tgl.warn[aria-pressed="true"] { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--cal)); }
details.tr { margin-top: 16px; background: var(--bg); border-radius: 14px; padding: 0 14px; }
details.tr summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.tr summary::-webkit-details-marker { display: none; }
details.tr summary .miss { color: #9A6A00; font-weight: 600; font-size: .85rem; }
details.tr[open] { padding-bottom: 14px; }
details.tr .lang-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
details.tr .lang-block:first-of-type { border-top: 0; margin-top: 0; }
details.tr .input { background: var(--cal); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px;
  border-radius: 14px; font-weight: 700; text-decoration: none; font-size: 1rem;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.dark { background: var(--ink); color: var(--cal); }
.btn.ghost { background: var(--cal); color: var(--ink); border: 1px solid var(--line); }
.panel .btn.ghost, .sheet .btn.ghost { background: var(--bg); }
.btn.danger { color: var(--danger); background: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .92rem; border-radius: 12px; }
.btn:disabled { opacity: .5; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.actions .btn { flex: 1; }
.sheet-save { position: sticky; bottom: -24px; background: var(--cal); padding: 12px 0 6px; margin-top: 18px; display: flex; gap: 10px; }
.sheet-save .btn { flex: 1; }

.photo-edit { position: relative; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; background: var(--tint); display: grid; place-items: center; font-size: 4.5rem; }
.photo-edit img { width: 100%; height: 100%; object-fit: cover; }
.photo-edit .ctrls { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 8px; }
.photo-edit .ctrls .btn { flex: 1; background: rgb(255 255 255 / .94); color: #16182A; min-height: 44px; font-size: .95rem; }
.photo-edit .hint { position: absolute; top: 12px; left: 12px; right: 12px; font-size: .85rem; background: var(--albero); color: #16182A; border-radius: 10px; padding: 7px 10px; font-weight: 600; }
.upload { position: relative; overflow: hidden; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch { width: 40px; height: 40px; border-radius: 12px; border: 3px solid transparent; }
.swatch[aria-pressed="true"] { border-color: var(--ink); }
input[type="color"] { width: 48px; height: 44px; border: 0; background: none; padding: 0; }

/* Datos */
.seg { display: inline-flex; background: var(--cal); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.seg button { height: 36px; padding: 0 14px; border-radius: 9px; font-weight: 650; font-size: .92rem; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--cal); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--cal); border-radius: var(--radius-m); padding: 16px; }
.kpi b { display: block; font-size: 2.1rem; letter-spacing: -.03em; line-height: 1; font-weight: 800; }
.kpi span { color: var(--ink-2); font-size: .9rem; }
.kpi.hl { background: var(--albero); color: #16182A; }
.kpi.hl span { color: #16182A; opacity: .8; }
.insight { margin: 14px 0; padding: 16px; border-radius: var(--radius-m); color: #fff; font-size: 1.05rem; line-height: 1.4; font-weight: 550; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin-top: 12px; }
.bars div { flex: 1; background: var(--brand); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; }
.bars div.zero { background: var(--line); }
.bar-labels { display: flex; gap: 4px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: .7rem; color: var(--ink-3); }
.hbar { display: grid; grid-template-columns: 110px 1fr 44px; gap: 10px; align-items: center; padding: 7px 0; font-weight: 600; font-size: .95rem; }
.hbar .track { height: 12px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.hbar em { font-style: normal; text-align: right; color: var(--ink-2); }

/* QR */
.qr-card { text-align: center; }
.qr-card img { width: min(260px, 70vw); margin: 8px auto 14px; border-radius: 14px; background: #fff; padding: 10px; }
.url-box { display: flex; gap: 8px; align-items: center; background: var(--bg); border-radius: 12px; padding: 6px 6px 6px 14px; text-align: left; }
.url-box code { flex: 1; font-family: inherit; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Acceso */
.login { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; }
.login .top { display: flex; align-items: flex-end; padding: 40px 24px; color: #fff; min-height: 38dvh; }
.login .top h1 { margin: 0; font-size: clamp(2.2rem, 9vw, 3.2rem); line-height: 1; letter-spacing: -.035em; max-width: 720px; }
.login form { background: var(--cal); padding: 26px 24px calc(30px + env(safe-area-inset-bottom)); border-radius: var(--radius-l) var(--radius-l) 0 0; margin-top: -24px; }
.login .inner { max-width: 440px; margin: 0 auto; }
.error { color: var(--danger); font-weight: 600; margin: 10px 0 0; min-height: 1.4em; }
.cat-edit { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat-edit .mv { display: flex; gap: 4px; }
.cat-edit .mv button { width: 38px; height: 44px; border-radius: 10px; background: var(--bg); }
.cat-edit .icon-in { text-align: center; padding: 0; font-size: 1.3rem; }

.mv-btns { display: flex; gap: 6px; }
.mv-btns button { width: 44px; height: 44px; border-radius: 12px; background: var(--bg); font-size: 1.15rem; font-weight: 700; }

.badge { position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font: 700 .7rem/18px var(--font); text-align: center; filter: none; }
.tabbar button .i:has(.badge) { filter: none; opacity: 1; }
.warn-panel { background: var(--albero-soft); margin-top: 10px; font-weight: 550; }
.res { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.res:last-child { border-bottom: 0; }
.res.no { opacity: .5; }
.res-time { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.res-time small { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-top: 4px; }
.res-body strong { display: block; font-size: 1.05rem; }
.res-body small { color: var(--ink-3); font-size: .86rem; overflow-wrap: anywhere; }
.res-notes { margin: 6px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: .92rem; }
.res-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.pill-st { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill-st.pend { background: var(--albero-soft); color: #8A5A00; }
.pill-st.ok { background: color-mix(in srgb, var(--hoja) 16%, var(--cal)); color: var(--hoja); }
.pill-st.no { background: color-mix(in srgb, var(--danger) 14%, var(--cal)); color: var(--danger); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days .tgl { justify-content: center; padding: 10px 0; }
.res-contact { margin-left: auto; display: flex; gap: 6px; }
.icon-act { width: 40px; height: 40px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; text-decoration: none; font-size: 1.1rem; }
