@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #12151b;
  --surface: #1b2029;
  --surface-alt: #232a35;
  --surface-raised: #2a3240;
  --border: #313a48;
  --text: #e7eaee;
  --text-muted: #8a93a3;
  --accent: #d4a24c;
  --accent-dim: #4a3d24;
  --success: #4fae7c;
  --danger: #e15252;
  --radius: 10px;
  --font-ui: 'Manrope', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}


/* ---------- Tema de dia (Mi perfil → Apariencia). "auto" sigue al sistema ---------- */
html[data-theme="light"] {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-alt: #eef0f4;
  --surface-raised: #ffffff;
  --border: #d9dde5;
  --text: #1c2230;
  --text-muted: #5d6677;
  --accent: #a8741a;
  --accent-dim: #f5e8cc;
  --success: #23794f;
  --danger: #c43333;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  html[data-theme="auto"] {
    --bg: #f4f5f8;
    --surface: #ffffff;
    --surface-alt: #eef0f4;
    --surface-raised: #ffffff;
    --border: #d9dde5;
    --text: #1c2230;
    --text-muted: #5d6677;
    --accent: #a8741a;
    --accent-dim: #f5e8cc;
    --success: #23794f;
    --danger: #c43333;
    color-scheme: light;
  }
}
html[data-theme="dark"], html:not([data-theme]) { color-scheme: dark; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  min-height: 100vh;
}

a { color: inherit; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
}

::selection { background: var(--accent-dim); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Layout raiz ---------- */
#app { display: flex; width: 100%; min-height: 100vh; }

.gate-mark {
  width: 34px; height: 34px; border-radius: 8px;
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-weight: 800; font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ---------- Sidebar (desktop) ---------- */
.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand strong { font-size: 1.05rem; letter-spacing: -0.01em; }
.sidebar-brand span { display: block; font-size: 0.72rem; color: var(--text-muted); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--surface-alt); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ---------- Contenido principal ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  flex-shrink: 0;
}

.topbar h1 { font-size: 1.05rem; margin: 0; font-weight: 700; }
.topbar .who { font-size: 0.82rem; color: var(--text-muted); }

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  padding-bottom: 90px; /* espacio para tab bar movil */
}

/* ---------- Bottom tab bar (movil) ---------- */
.tabbar { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  #app { flex-direction: column; }
  .tabbar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    justify-content: flex-start;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 20;
    /* si no caben todas las opciones, la barra se desliza hacia los lados */
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar .nav-item {
    flex: 1 0 68px;
    max-width: 96px;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.66rem;
    line-height: 1.15;
    padding: 6px 4px;
    width: auto;
    text-align: center;
    scroll-snap-align: start;
    position: relative;
  }
  .tabbar .nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabbar .nav-item .i { width: 22px; height: 22px; }
  .tabbar .nav-item .nav-badge { position: absolute; top: 2px; right: 10px; }
  /* indicador de que hay mas opciones a los lados */
  .tabbar.more-right { box-shadow: inset -18px 0 14px -14px rgba(0,0,0,.25); }
  .tabbar.more-left { box-shadow: inset 18px 0 14px -14px rgba(0,0,0,.25); }
  .tabbar.more-left.more-right { box-shadow: inset -18px 0 14px -14px rgba(0,0,0,.25), inset 18px 0 14px -14px rgba(0,0,0,.25); }
}

/* ---------- Componentes ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

.stat {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 14px;
}
.stat .value { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 600; }
.stat .label { font-size: 0.78rem; color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover { background: var(--surface-raised); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1b1508; }
.btn-primary:hover { background: #e0ad5c; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(225, 82, 82, 0.12); }
.btn-sm { padding: 6px 10px; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
}

table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
thead th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 10px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--surface-alt); }
.mono { font-family: var(--font-mono); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-success { background: rgba(79, 174, 124, 0.15); color: var(--success); }
.badge-danger { background: rgba(225, 82, 82, 0.15); color: var(--danger); }
.badge-muted { background: var(--surface-alt); color: var(--text-muted); }

.door-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.door-card .name { font-weight: 700; font-size: 1rem; }
.door-card .location { font-size: 0.8rem; color: var(--text-muted); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%; max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}

.toast {
  position: fixed; top: 18px; right: 18px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.86rem;
  z-index: 100;
  max-width: 320px;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 0.9rem;
}

.login-screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
}
.login-box .gate-mark { margin-bottom: 18px; }
.login-box h1 { font-size: 1.3rem; margin: 0 0 4px 0; }
.login-box p { color: var(--text-muted); font-size: 0.86rem; margin: 0 0 24px 0; }

.qr-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.qr-preview img { border-radius: 8px; background: #fff; padding: 10px; }
.qr-preview .expires { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }

.tag-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.field-help {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.5;
}

.field input[type="checkbox"] { width: auto; margin: 0; }

textarea { font-family: var(--font-mono); font-size: 0.82rem; resize: vertical; }

a.btn { text-decoration: none; }

.tag-row .btn { white-space: nowrap; }

/* ---------- Rostros: captura de foto ---------- */
.photo-capture { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pc-preview {
  width: 96px; height: 128px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  background: var(--surface-alt); border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
}
.pc-preview img { width: 100%; height: 100%; object-fit: cover; }
.pc-placeholder { font-size: 2.6rem; color: var(--text-muted); }
.pc-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; flex: 1; min-width: 160px; }
.pc-upload { cursor: pointer; }

.camera-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.88);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.camera-box { width: 100%; max-width: 420px; }
.camera-frame { position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: #000; }
.camera-frame video { width: 100%; height: 100%; object-fit: cover; }
.camera-frame video.mirror { transform: scaleX(-1); }
.camera-guide {
  position: absolute; left: 50%; top: 44%; width: 58%; height: 62%; transform: translate(-50%, -50%);
  border: 3px dashed rgba(212, 162, 76, 0.9); border-radius: 50%; pointer-events: none;
}

/* ---------- Rostros: tarjetas ---------- */
.person-card { display: flex; gap: 12px; align-items: flex-start; }
.person-card .avatar {
  width: 64px; height: 84px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
  background: var(--surface-alt); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1.6rem;
}
.person-card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-card .info { flex: 1; min-width: 0; }
.person-card .name { font-weight: 700; }
.sync-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quota-bar { height: 8px; background: var(--surface-alt); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.quota-bar > div { height: 100%; background: var(--accent); }
.mono-copy { font-family: var(--font-mono); font-size: 0.78rem; word-break: break-all; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Menu del usuario (barra superior) y boton de actualizar la app */
.user-menu { position: relative; }
.topbar button.who {
  background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  padding: 6px 10px; font: inherit; font-size: 0.82rem; color: var(--text-muted);
}
.topbar button.who:hover, .topbar button.who[aria-expanded="true"] { border-color: var(--border); color: var(--text); }
.user-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 250px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); padding: 6px; display: flex; flex-direction: column;
}
.user-menu-list[hidden] { display: none; }
.user-menu-list button {
  background: none; border: 0; text-align: left; padding: 10px 12px; border-radius: 8px;
  color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer;
}
.user-menu-list button:hover { background: var(--surface-alt); }
.user-menu-list button:disabled { opacity: 0.6; cursor: wait; }
.link-btn {
  background: none; border: 0; color: var(--text-muted); font: inherit; font-size: 0.82rem;
  margin-top: 16px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); }

/* ---------- Finanzas ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 640px; }
.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.fin-range { display: flex; gap: 10px; flex-wrap: wrap; }
.fin-range .field { min-width: 140px; flex: 1; }
.fin-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 12px; margin-bottom: 18px; }
.fin-kpis.small { margin-bottom: 0; }
.fin-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; border-top: 3px solid var(--border); }
.fin-kpis.small .fin-kpi { background: var(--bg); }
.fin-kpi .label { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; }
.fin-kpi .value { font-size: 1.3rem; font-weight: 600; margin-top: 4px; }
.fin-kpi.good { border-top-color: var(--success); }
.fin-kpi.bad { border-top-color: var(--danger); }
.fin-kpi.accent { border-top-color: var(--accent); }
.fin-kpi.warn .value { color: var(--danger); }
.fin-bars { display: flex; flex-direction: column; gap: 12px; }
.fin-bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.86rem; margin-bottom: 4px; }
.fin-bar-track { position: relative; height: 8px; border-radius: 6px; background: var(--surface-alt); }
.fin-bar-fill { height: 100%; border-radius: 6px; min-width: 2px; }
.fin-bar-budget { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text); opacity: 0.6; }
.fin-chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; overflow-x: auto; padding-bottom: 4px; }
.fin-chart-col { flex: 1; min-width: 34px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.fin-chart-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.fin-chart-bar { width: 40%; max-width: 18px; border-radius: 4px 4px 0 0; min-height: 1px; }
.fin-chart-bar.in, .fin-legend i.in { background: var(--success); }
.fin-chart-bar.out, .fin-legend i.out { background: var(--danger); }
.fin-chart-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; white-space: nowrap; }
.fin-legend { display: flex; gap: 14px; font-size: 0.76rem; color: var(--text-muted); margin-top: 8px; }
.fin-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.fin-balance { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; }
.fin-alert { border-left: 3px solid var(--danger); }
.fin-ok { border-left: 3px solid var(--success); }
.fin-charge { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.fin-charge:last-child { border-bottom: 0; }
.fin-charge .grow { flex: 1; min-width: 0; }
.fin-charge input[type=checkbox] { width: 18px; height: 18px; }
.cat-child td:first-child { padding-left: 28px; }
.tabs-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.tabs-scroll .btn { white-space: nowrap; }
.panel-title { flex-wrap: wrap; gap: 8px; }
.badge { white-space: nowrap; }
.wa-btn { background: #25d366; border-color: #25d366; color: #fff; }
.wa-btn:hover { background: #1ebe5b; }

/* ---------- Tutores (escuelas) ---------- */
.notice-text { white-space: pre-wrap; max-height: 320px; overflow-y: auto; padding: 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; font-size: 0.86rem; line-height: 1.5; }
.consent-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.consent-item input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }
.consent-item input:disabled + span { opacity: 0.5; }
.sign-pad { width: 100%; height: auto; aspect-ratio: 3 / 1; background: #fff; border-radius: 8px; border: 1px solid var(--border); touch-action: none; cursor: crosshair; }
.kid-times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kid-times .label { font-size: 0.76rem; color: var(--text-muted); }
.kid-times .value { font-size: 1.5rem; font-weight: 600; }
.var-chip { display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; padding: 2px 6px; border-radius: 6px;
  background: var(--surface-alt); margin: 2px; cursor: pointer; }

/* ---------- Campana de notificaciones ---------- */
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.notif-wrap { position: relative; }
.notif-btn {
  position: relative; background: none; border: 1px solid transparent; border-radius: 8px;
  font-size: 1.15rem; padding: 4px 9px; cursor: pointer; color: var(--text-muted); line-height: 1.3;
}
.notif-btn:hover, .notif-btn[aria-expanded="true"] { border-color: var(--border); color: var(--text); }
.notif-count {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-family: var(--font-ui);
}
.notif-count[hidden] { display: none; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 61; width: min(360px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column; max-height: 70vh;
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.notif-head button, .notif-settings-btn {
  background: none; border: 0; color: var(--accent); font: inherit; font-size: 0.8rem; cursor: pointer;
}
.notif-settings-btn { padding: 10px 12px; border-top: 1px solid var(--border); text-align: left; color: var(--text-muted); }
.notif-items { overflow-y: auto; flex: 1; }
.notif-empty { padding: 22px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.notif-item {
  display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--border); padding: 10px 12px; color: var(--text); font: inherit; cursor: pointer;
}
.notif-item:hover { background: var(--surface-alt); }
.notif-item.unread { background: rgba(212, 162, 76, 0.08); }
.notif-item.unread strong::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: middle; }
.notif-ic { font-size: 1.2rem; line-height: 1.2; }
.notif-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 0.86rem; }
.notif-txt span { color: var(--text-muted); }
.notif-txt small { color: var(--text-muted); font-size: 0.72rem; }
.notif-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 200;
  width: min(440px, calc(100vw - 24px)); display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface-raised); border: 1px solid var(--accent); border-radius: 12px;
  padding: 14px 16px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); cursor: pointer;
  animation: notif-in 0.25s ease-out;
}
.notif-banner.kind-visitor_in { border-color: var(--success); }
.notif-banner div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-banner div span { color: var(--text-muted); font-size: 0.86rem; }
.notif-banner button { background: none; border: 0; color: var(--text-muted); font-size: 1.3rem; cursor: pointer; line-height: 1; }
@keyframes notif-in { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.check-row { display: flex; gap: 8px; align-items: center; margin: 10px 0; cursor: pointer; }
.check-row input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.btn[hidden] { display: none; }
@media (max-width: 760px) {
  .notif-panel { position: fixed; top: 58px; left: 12px; right: 12px; width: auto; max-height: 75vh; }
  .topbar .who { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- Aviso para instalar la app ---------- */
.install-banner {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 190;
  width: min(460px, calc(100vw - 24px)); display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface-raised); border: 1px solid var(--accent); border-radius: 14px;
  padding: 14px 16px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); animation: notif-in 0.25s ease-out;
}
.install-banner img { border-radius: 10px; flex-shrink: 0; }
.install-text { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.install-text span { color: var(--text-muted); }
.install-actions { display: flex; gap: 8px; margin-top: 8px; }
@media (min-width: 861px) { .install-banner { bottom: 24px; } }

/* ---------- Mi perfil ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 18px; align-items: start; }
.profile-grid .panel { margin-bottom: 0; }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.profile-avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; flex-shrink: 0;
}
.profile-rows { display: flex; flex-direction: column; }
.profile-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.profile-row span { color: var(--text-muted); }
.profile-row strong { text-align: right; font-weight: 600; word-break: break-word; }
.segmented { display: flex; gap: 4px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.seg-btn { flex: 1; white-space: nowrap; background: none; border: 0; border-radius: 8px; padding: 10px 8px; cursor: pointer; color: var(--text-muted); font: inherit; font-size: 0.9rem; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); font-weight: 600; }
.session-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }

/* ---------- Mensajes (chat con la administracion) ---------- */
.chat-panel { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: calc(100vh - 170px); min-height: 420px; margin-bottom: 0; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.chat-msg { max-width: min(78%, 560px); align-self: flex-start; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 8px 12px; }
.chat-msg.mine { align-self: flex-end; background: var(--accent-dim); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.chat-text { white-space: pre-wrap; word-break: break-word; font-size: 0.95rem; line-height: 1.4; }
.chat-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; text-align: right; }
.chat-who { font-size: 0.72rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.chat-sys { align-self: center; font-size: 0.78rem; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; }
.chat-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-compose textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; font-family: var(--font-ui); font-size: 0.95rem; padding: 11px 12px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.chat-compose textarea:focus { outline: none; border-color: var(--accent); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); opacity: 0.5; flex-shrink: 0; }
.dot.on { background: var(--success); opacity: 1; }
.chat-inbox { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.chat-list-panel { height: calc(100vh - 170px); min-height: 420px; display: flex; flex-direction: column; margin-bottom: 0; }
.chat-threads { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.chat-thread { display: flex; gap: 10px; align-items: center; text-align: left; background: none; border: 1px solid transparent; border-radius: 10px; padding: 10px; color: var(--text); font: inherit; cursor: pointer; }
.chat-thread:hover { background: var(--surface-alt); }
.chat-thread.active { background: var(--accent-dim); }
.chat-thread .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-thread small { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-back { display: none; margin: 10px 12px 0; align-self: flex-start; }
@media (max-width: 860px) {
  .chat-inbox { grid-template-columns: 1fr; }
  .chat-inbox.has-selected .chat-list-panel { display: none; }
  .chat-inbox:not(.has-selected) #chat-conv { display: none; }
  .chat-back { display: inline-flex; }
  .chat-panel, .chat-list-panel { height: calc(100vh - 210px); }
}
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 9px; font-size: 0.68rem; font-weight: 800; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.nav-badge[hidden] { display: none; }

/* ---------- Llamada de voz ---------- */
.call-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(8, 10, 16, 0.72); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); }
.call-card { width: min(380px, 100%); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 20px; padding: 30px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
.call-avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.call-avatar.ringing { animation: call-pulse 1.2s ease-in-out infinite; }
@keyframes call-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(79, 174, 124, 0.55); } 50% { box-shadow: 0 0 0 18px rgba(79, 174, 124, 0); } }
.call-name { font-size: 1.25rem; }
.call-sub { color: var(--text-muted); font-size: 0.9rem; }
.call-actions { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.call-btn { border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); border-radius: 999px; padding: 12px 20px; font: inherit; font-weight: 700; cursor: pointer; }
.call-btn.call-accept { background: var(--success); border-color: var(--success); color: #fff; }
.call-btn.call-hang { background: var(--danger); border-color: var(--danger); color: #fff; }
.call-btn[aria-pressed="true"] { background: var(--accent-dim); }

/* ---------------- Caseta de vigilancia ---------------- */
:root { --warning: #e0a030; }
.badge-warning { background: rgba(224, 160, 48, 0.18); color: var(--warning); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success); filter: brightness(1.1); }
.btn-lg { padding: 14px 20px; font-size: 1.02rem; font-weight: 700; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.filters .field { margin: 0; min-width: 140px; flex: 1 1 140px; }
.filters .check-row { margin: 0 0 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.simple-list li:last-child { border-bottom: 0; }
.simple-list li .btn { margin-left: auto; }
.caseta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.arrivals { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.arrival-card { border: 2px solid var(--warning); border-radius: 14px; padding: 16px; background: var(--surface-alt); display: flex; flex-direction: column; gap: 8px; animation: arrival-in .35s ease-out; }
.arrival-card header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.arrival-name { margin: 2px 0 0; font-size: 1.5rem; line-height: 1.2; overflow-wrap: anywhere; }
.arrival-dest { font-size: 1.02rem; }
.arrival-car { font-size: 1.08rem; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arrival-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-top: 4px; }
.arrival-actions .btn { justify-content: center; }
@keyframes arrival-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.plate { display: inline-block; font-family: var(--font-mono); font-weight: 700; letter-spacing: .08em; padding: 2px 8px; border: 2px solid var(--text); border-radius: 6px; background: var(--surface); color: var(--text); font-size: .92em; }
.visit-data { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); gap: 6px 12px; margin: 4px 0; }
.visit-data div { background: var(--surface); border-radius: 8px; padding: 6px 10px; }
.visit-data div.hl { outline: 2px solid var(--accent); }
.visit-data dt { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.visit-data dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.visit-fields { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; }
.visit-fields legend { padding: 0 6px; font-weight: 700; font-size: .85rem; }
.doc-preview { min-height: 120px; border: 1px dashed var(--border); border-radius: var(--radius); display: grid; place-items: center; background: var(--surface-alt); color: var(--text-muted); margin-bottom: 8px; overflow: hidden; }
.doc-preview img { width: 100%; max-height: 300px; object-fit: contain; display: block; }
.field .doc-capture .tag-row label.btn, .doc-capture .tag-row label.btn { display: inline-flex; margin: 0; font-size: 0.78rem; color: var(--text); cursor: pointer; }
.doc-capture .tag-row label.btn-primary { color: #1b1508; }
.package-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.package-card:last-child { border-bottom: 0; }
.package-card.delivered { opacity: .72; }
.package-ico { font-size: 1.6rem; line-height: 1; }
.package-card .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.package-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 520px) {
  .package-card { flex-wrap: wrap; }
  .package-actions { flex-direction: row; flex-wrap: wrap; width: 100%; justify-content: flex-start; }
  .arrival-actions { grid-template-columns: 1fr; }
}
.mp-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-alt); display: grid; gap: 10px; }
.mp-box .tag-row { flex-wrap: wrap; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { flex: 1; font-family: var(--font-mono); font-size: .78rem; }
@media (max-width: 640px) {
  .table-wrap:has(.caseta-table) { overflow: visible; }
  .caseta-table { min-width: 0 !important; width: 100%; }
  .caseta-table thead { display: none; }
  .caseta-table, .caseta-table tbody, .caseta-table tr, .caseta-table td { display: block; }
  .caseta-table tr { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; }
  .caseta-table td { border: 0 !important; padding: 4px 0 4px 92px !important; position: relative; overflow-wrap: anywhere; }
  .caseta-table td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 6px; width: 84px; color: var(--text-muted); font-size: .75rem; font-weight: 600; }
  .caseta-table td.actions { padding-left: 0 !important; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
}

/* ---------------- Membresias ---------------- */
.gym-bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 6px; border-bottom: 1px solid var(--border); }
.gym-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.gym-bar i { display: block; width: 100%; min-height: 1px; background: var(--accent); border-radius: 4px 4px 0 0; }
.gym-bar:hover i { filter: brightness(1.15); }
.gym-bars-axis { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text-muted); margin: 4px 0 8px; }
.gym-heat { display: grid; gap: 2px; font-size: .68rem; color: var(--text-muted); overflow-x: auto; }
.gym-heat-h { text-align: center; }
.gym-heat-d { align-self: center; }
.gym-heat-c { height: 18px; border-radius: 3px; background: color-mix(in srgb, var(--accent) calc(var(--a) * 100%), var(--surface-alt)); }
.gym-hbar { margin-bottom: 10px; }
.gym-hbar-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.gym-hbar-track { height: 10px; background: var(--surface-alt); border-radius: 5px; overflow: hidden; }
.gym-hbar-track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.rc-search { display: flex; gap: 8px; margin-bottom: 10px; }
.rc-search input { flex: 1; font-size: 1.05rem; padding: 12px 14px; }
.rc-list { display: grid; gap: 6px; }
.rc-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.rc-row:hover { background: var(--surface-alt); }
.rc-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-row small { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-no { font-family: var(--font-mono); color: var(--text-muted); min-width: 40px; }
.rc-state { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: .78rem; color: var(--text-muted); text-align: right; }
.rc-card { display: flex; gap: 14px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 2px solid var(--border); margin-bottom: 12px; }
.rc-card.rc-active { border-color: var(--success); }
.rc-card.rc-expired, .rc-card.rc-exhausted { border-color: var(--danger); }
.rc-card .grow { flex: 1; min-width: 0; }
.rc-photo { width: 84px; height: 112px; border-radius: 10px; background: var(--surface-alt); display: grid; place-items: center; color: var(--text-muted); font-size: .72rem; overflow: hidden; flex-shrink: 0; }
.rc-photo img { width: 100%; height: 100%; object-fit: cover; }
.rc-big { font-size: 1.02rem; margin-bottom: 4px; }
.rc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.rc-plans { display: grid; gap: 6px; margin-bottom: 12px; }
.rc-plan { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.rc-plan:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.rc-plan input { width: auto; }
.rc-plan span { flex: 1; display: flex; flex-direction: column; }
.rc-plan small { color: var(--text-muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-block; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-weight: 600; font-size: .86rem; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: #1b1508; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cls-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); width: 100%; }
.cls-row:last-child { border-bottom: 0; }
.cls-row.cancelled { opacity: .55; }
.cls-row .grow { flex: 1; min-width: 0; }
.cls-btn { background: none; border-left: 0; border-right: 0; border-top: 0; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.cls-btn:hover { background: var(--surface-alt); }
.cls-time { font-family: var(--font-mono); font-weight: 700; min-width: 58px; display: flex; flex-direction: column; }
.cls-time small, .cls-occ small { font-weight: 400; color: var(--text-muted); font-size: .72rem; }
.cls-occ { display: flex; flex-direction: column; align-items: flex-end; }
.mb-hero { border-radius: 14px; padding: 18px; margin: 8px 0; background: var(--surface-alt); border: 2px solid var(--border); }
.mb-hero.ok { border-color: var(--success); }
.mb-hero.bad { border-color: var(--danger); }
.mb-state { font-size: 1.5rem; font-weight: 800; }
.mb-hero.ok .mb-state { color: var(--success); }
.mb-hero.bad .mb-state { color: var(--danger); }
.mb-until { font-size: 1.1rem; margin-top: 4px; }
.mb-sub { color: var(--text-muted); margin-top: 4px; }
.mb-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; margin-bottom: 8px; }
.mb-plan { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.mb-price { font-size: 1.35rem; font-weight: 700; }
.mb-plan small { color: var(--text-muted); }
/* ---------------- Punto de venta ---------------- */
.pos-wrap { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .pos-wrap { grid-template-columns: minmax(0, 1fr); } }
.pos-wrap > * { min-width: 0; }
.pos-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.pos-top > span:empty { display: none; }
.pos-top input { flex: 1 1 180px; min-width: 0; font-size: 1rem; padding: 11px 12px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 8px; }
.pos-item { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 12px; min-height: 86px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); color: var(--text); cursor: pointer; font: inherit; }
.pos-item:hover { border-color: var(--accent); }
.pos-item.out { opacity: .45; cursor: not-allowed; }
.pos-item small { color: var(--text-muted); font-size: .72rem; }
.pos-cart { position: sticky; top: 12px; }
.pos-line { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.pos-line .grow { flex: 1; min-width: 0; }
.pos-total { display: flex; justify-content: space-between; font-size: 1.3rem; margin: 12px 0; }
.pos-ticket { font-family: var(--font-mono); font-size: .85rem; background: #fff; color: #111; padding: 14px; border-radius: 6px; }
.pos-ticket hr { border: 0; border-top: 1px dashed #999; }
.pos-tline { display: flex; justify-content: space-between; gap: 8px; }
.pos-change-big { font-size: 1.6rem; font-weight: 800; text-align: center; margin-top: 12px; color: var(--success); }

/* ---------------- Iconos SVG ---------------- */
.i { width: 1.15em; height: 1.15em; vertical-align: -0.22em; flex-shrink: 0; stroke-width: 1.8; }
.nav-item .i { width: 20px; height: 20px; }
.btn .i { width: 1.1em; height: 1.1em; }
.notif-btn .i { width: 22px; height: 22px; vertical-align: middle; }
.status-icon .i { width: 56px; height: 56px; }
.call-avatar .i { width: 40px; height: 40px; }
.period { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.period .field { margin: 0; min-width: 150px; flex: 1 1 150px; }
.door-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.door-head > .i { width: 28px; height: 28px; color: var(--accent); }
/* ---------------- Marca, soporte, seguridad ---------------- */
.powered { display: flex; align-items: center; gap: 8px; padding: 12px 8px 0; margin-top: 8px; border-top: 1px solid var(--border); font-size: .74rem; color: var(--text-muted); line-height: 1.2; }
.powered img { width: 34px; height: 28px; object-fit: contain; }
.powered small { font-size: .7rem; }
.brand-preview { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius); }
.brand-preview img { height: 64px; max-width: 120px; object-fit: contain; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 12px; }
.sec-role { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.sec-role h4 { margin: 0 0 6px; }
.sec-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.sec-item:last-child { border-bottom: 0; }
.sec-item input { width: auto; }
.sec-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sec-item small { color: var(--text-muted); font-size: .72rem; }
.sec-item .i { color: var(--text-muted); }
.support-card { text-align: center; max-width: 520px; margin: 0 auto; padding: 28px 20px; }
.support-ic .i { width: 54px; height: 54px; color: var(--accent); }
.support-card h2 { margin: 8px 0; }
.support-card p { color: var(--text-muted); }
.support-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 22px; font-size: .78rem; color: var(--text-muted); }
.support-brand img { height: 34px; }
.bc-preview .notif-banner { position: static; transform: none; margin-top: 12px; max-width: 420px; animation: none; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; font-size: .78rem; color: var(--text-muted); }
.login-brand img { height: 40px; max-width: 90px; object-fit: contain; }
/* ---------------- Guia animada de instalacion en iPhone ---------------- */
.ios-guide-backdrop { position: fixed; inset: 0; background: rgba(8,10,14,.55); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 861px) { .ios-guide-backdrop { align-items: center; } }
.ios-guide { background: var(--surface); color: var(--text); width: min(420px, 100%); border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; animation: ios-up .3s ease-out; }
@media (min-width: 861px) { .ios-guide { border-radius: 18px; } }
@keyframes ios-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.ios-title { display: block; font-size: 1.05rem; text-align: center; margin-bottom: 12px; }
.ios-stage { display: flex; justify-content: center; margin-bottom: 12px; }
.ios-phone { width: 168px; height: 300px; border-radius: 28px; background: #111; padding: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.ios-screen { position: relative; width: 100%; height: 100%; border-radius: 20px; overflow: hidden; background: #f2f2f7; color: #111; font-size: 9px; }
.ios-safari { position: absolute; inset: 0; display: flex; flex-direction: column; }
.ios-url { margin: 14px 10px 6px; background: #e3e3e8; border-radius: 7px; padding: 4px 6px; text-align: center; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ios-page { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 7px; }
.ios-page span { height: 9px; border-radius: 4px; background: #d9d9e0; }
.ios-page span.short { width: 60%; }
.ios-toolbar { height: 30px; background: #f9f9fb; border-top: 1px solid #ddd; display: flex; align-items: center; justify-content: space-around; }
.ios-toolbar i { width: 11px; height: 11px; border-radius: 3px; background: #c7c7cc; }
.ios-share { color: #0a84ff; display: grid; place-items: center; animation: ios-share 9s infinite; }
.ios-share .i { width: 16px; height: 16px; }
.ios-sheet { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 12px 12px 0 0; padding: 8px; box-shadow: 0 -4px 14px rgba(0,0,0,.15); transform: translateY(105%); animation: ios-sheet 9s infinite; }
.ios-sheet-head { display: flex; align-items: center; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid #eee; margin-bottom: 4px; font-weight: 700; }
.ios-sheet-head img { width: 18px; height: 18px; border-radius: 4px; }
.ios-row { padding: 6px 4px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.ios-row .i { width: 12px; height: 12px; }
.ios-add { animation: ios-add 9s infinite; border-radius: 6px; }
.ios-home { position: absolute; inset: 0; background: linear-gradient(160deg, #6a5acd, #2a9df4); opacity: 0; animation: ios-home 9s infinite; padding: 22px 12px; }
.ios-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 8px; }
.ios-grid span { width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.35); justify-self: center; }
.ios-grid .ios-app { background: none; width: auto; height: auto; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #fff; animation: ios-app 9s infinite; }
.ios-app img { width: 26px; height: 26px; border-radius: 7px; }
.ios-app small { font-size: 7px; max-width: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-tap { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(10,132,255,.9); background: rgba(10,132,255,.25); opacity: 0; animation: ios-tap 9s infinite; pointer-events: none; }
.ios-steps { margin: 0 0 8px; padding-left: 0; list-style: none; counter-reset: s; display: grid; gap: 6px; }
.ios-steps li { counter-increment: s; display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-alt); opacity: .55; font-size: .9rem; }
.ios-steps li::before { content: counter(s); flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--border); font-weight: 700; font-size: .78rem; }
.ios-steps li .i { width: 18px; height: 18px; color: #0a84ff; }
.ios-steps .s1 { animation: ios-step1 9s infinite; }
.ios-steps .s2 { animation: ios-step2 9s infinite; }
.ios-steps .s3 { animation: ios-step3 9s infinite; }
@keyframes ios-share { 0%, 8% { transform: scale(1); } 14% { transform: scale(1.35); } 20%, 100% { transform: scale(1); } }
@keyframes ios-sheet { 0%, 26% { transform: translateY(105%); } 34%, 62% { transform: translateY(0); } 68%, 100% { transform: translateY(105%); } }
@keyframes ios-add { 0%, 46% { background: transparent; } 50%, 62% { background: rgba(10,132,255,.18); } 66%, 100% { background: transparent; } }
@keyframes ios-home { 0%, 64% { opacity: 0; } 70%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ios-app { 0%, 70% { transform: scale(0); } 78% { transform: scale(1.2); } 84%, 100% { transform: scale(1); } }
@keyframes ios-tap {
  0%, 9% { opacity: 0; left: 64px; bottom: 6px; transform: scale(.6); }
  12% { opacity: 1; transform: scale(1); } 18% { opacity: 0; left: 64px; bottom: 6px; transform: scale(1.4); }
  44% { opacity: 0; left: 100px; bottom: 20px; transform: scale(.6); }
  50% { opacity: 1; left: 100px; bottom: 20px; transform: scale(1); } 57% { opacity: 0; left: 100px; bottom: 20px; transform: scale(1.4); }
  100% { opacity: 0; }
}
@keyframes ios-step1 { 0%, 30% { opacity: 1; background: var(--accent-dim); } 34%, 100% { opacity: .55; background: var(--surface-alt); } }
@keyframes ios-step2 { 0%, 30% { opacity: .55; background: var(--surface-alt); } 34%, 64% { opacity: 1; background: var(--accent-dim); } 68%, 100% { opacity: .55; background: var(--surface-alt); } }
@keyframes ios-step3 { 0%, 64% { opacity: .55; background: var(--surface-alt); } 68%, 100% { opacity: 1; background: var(--accent-dim); } }
@media (prefers-reduced-motion: reduce) {
  .ios-share, .ios-sheet, .ios-add, .ios-home, .ios-app, .ios-tap, .ios-steps li { animation: none !important; }
  .ios-sheet { transform: translateY(0); }
  .ios-steps li { opacity: 1; }
}
/* ---------------- Celular: nada se sale de la pantalla ---------------- */
@media (max-width: 860px) {
  /* tablas anchas: se desplazan dentro de su panel en vez de empujar la pagina */
  .panel table:not(.caseta-table):not(.am-table), .modal table:not(.caseta-table) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .panel, .modal { min-width: 0; }
  .field input, .field select, .field textarea { max-width: 100%; min-width: 0; }
  .tag-row { flex-wrap: wrap; }
  .panel-title { flex-wrap: wrap; gap: 8px; }
  .content { padding: 16px 12px 96px; }
  .modal { max-width: calc(100vw - 20px); }
}
.bc-preview .notif-banner { max-width: 100%; box-sizing: border-box; }
.grid > *, .grid-2 > *, .grid-3 > * { min-width: 0; }
img { max-width: 100%; }
.rc-search { flex-wrap: wrap; }
.rc-search input { min-width: 0; flex: 1 1 200px; }

/* ---- Caseta: por llegar y entradas sin intervencion */
.badge-info { background: rgba(80, 140, 230, 0.16); color: #5b8fe0; }
.arrival-card.auto { border-color: var(--success); }
.exp-search { margin-bottom: 8px; }
.expected-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; }
.expected-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-alt); min-width: 0; }
.expected-item .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.expected-item.new { border-color: #5b8fe0; animation: arrival-in .35s ease-out; }
.arrival-car.small { font-size: .82rem; margin-top: 2px; }
.btn-icon { padding: 6px 8px; display: inline-flex; align-items: center; justify-content: center; }

/* ---- Permisos de puertas (usuarios x puertas) */
.am-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.am-filters select { width: auto; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.am-search { flex: 1 1 260px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; background: var(--surface-alt); min-width: 0; }
.am-search input { border: 0; background: transparent; padding: 9px 0; flex: 1; min-width: 0; outline: none; }
.am-search .i { opacity: .6; flex: none; }
.am-bulk { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px; margin-bottom: 10px; border-radius: 12px;
  background: var(--accent-dim); position: sticky; top: 0; z-index: 3; }
.am-bulk select { width: auto; max-width: 100%; }
.am-bulk[hidden] { display: none; }
.am-wrap { overflow: auto; max-height: 65vh; border: 1px solid var(--border); border-radius: 12px; }
.am-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: max-content; }
.am-table th, .am-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.am-table thead th { position: sticky; top: 0; z-index: 2; font-size: .75rem; text-transform: none; }
.am-table .am-check { width: 34px; text-align: center; position: sticky; left: 0; z-index: 1; }
.am-table .am-user { position: sticky; left: 34px; z-index: 1; min-width: 180px; max-width: 260px; text-align: left; }
.am-table thead .am-check, .am-table thead .am-user { z-index: 3; }
.am-table .am-user strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-table .am-user small { color: var(--text-muted); font-size: .72rem; }
.am-table .am-door { min-width: 84px; max-width: 120px; text-align: center; }
.am-table .am-door span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-table tr.sel td { background: var(--accent-dim); }
.am-cell { text-align: center; }
.am-table input[type=checkbox] { width: 18px; height: 18px; }
.am-chip { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 52px; height: 32px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--text-muted); font: inherit; font-size: .72rem; cursor: pointer; position: relative; }
span.am-chip { height: 22px; min-width: 0; cursor: default; vertical-align: middle; }
.am-chip .i { width: 15px; height: 15px; }
.am-chip.open { background: rgba(79, 174, 124, .14); border-color: var(--success); color: var(--success); }
.am-chip.both { background: var(--success); border-color: var(--success); color: #fff; }
.am-chip.noapp { outline: 2px dashed var(--warning); outline-offset: 1px; }
.am-chip small { font-size: .6rem; margin-left: 2px; }
.am-chip:disabled { opacity: .6; cursor: not-allowed; }
.am-pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 10px; font-size: .85rem; }
@media (max-width: 640px) {
  .am-table .am-user { min-width: 130px; max-width: 150px; }
  .am-filters select { flex: 1 1 45%; }
}

/* ---- Escritorio: el menu lateral ya no alarga la pagina. El menu y el area
   de trabajo tienen su propio desplazamiento y ocupan exactamente la pantalla. */
@media (min-width: 861px) {
  #app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .sidebar { height: 100%; min-height: 0; overflow: hidden; padding-bottom: 12px; }
  .sidebar-brand { flex: none; }
  #nav-desktop { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 8px, #000 calc(100% - 14px), transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 8px, #000 calc(100% - 14px), transparent 100%); }
  #nav-desktop::-webkit-scrollbar { width: 6px; }
  #nav-desktop::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
  .sidebar-footer { flex: none; }
  .sidebar-footer .nav-item { padding: 8px 12px; }
  .main { height: 100%; min-height: 0; }
  .content { min-height: 0; padding-bottom: 32px; }
}
@media (min-width: 861px) and (max-height: 720px) {
  .sidebar-brand { padding-bottom: 12px; margin-bottom: 8px; }
  .nav-item { padding: 8px 12px; }
  .powered img { display: none; }
}

/* ---- Boton flotante de puertas (guardia / admin) */
.door-fab { position: fixed; right: 18px; bottom: 22px; z-index: 40; display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: 999px; border: 0; background: var(--accent); color: #1a1408; font: inherit; font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); cursor: pointer; }
.door-fab .i { width: 22px; height: 22px; }
.door-fab[aria-expanded="true"] { filter: brightness(.92); }
.door-fab-panel { position: fixed; right: 18px; bottom: 82px; z-index: 41; width: min(360px, calc(100vw - 24px)); max-height: min(70vh, 560px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .4); animation: arrival-in .2s ease-out; }
.door-fab-panel[hidden] { display: none; }
.dfp-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.dfp-head span { display: flex; gap: 6px; }
.dfp-body { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.dfp-door { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--surface-alt); }
.dfp-name { margin-bottom: 8px; }
.dfp-name small { display: block; color: var(--text-muted); font-size: .75rem; }
.dfp-door .btn { flex: 1; justify-content: center; }
@media (max-width: 860px) {
  .door-fab { right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); padding: 12px; }
  .door-fab span { display: none; }
  .door-fab-panel { right: 12px; left: 12px; width: auto; bottom: calc(136px + env(safe-area-inset-bottom)); }
}
.switch-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch-row input { width: 42px; height: 24px; flex: none; appearance: none; -webkit-appearance: none; border-radius: 999px; background: var(--border);
  position: relative; cursor: pointer; transition: background .15s; margin-top: 2px; }
.switch-row input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch-row input:checked { background: var(--success); }
.switch-row input:checked::after { transform: translateX(18px); }
.switch-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row small { display: block; color: var(--text-muted); font-size: .8rem; margin-top: 2px; }

/* ---- Registro por domicilios */
.ob-intro h2 { margin: 0 0 8px; font-size: 1.1rem; }
.ob-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-muted); }
.ob-steps strong { color: var(--text); }
.ob-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.ob-stats .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.ob-stats .stat span { display: block; font-size: .78rem; color: var(--text-muted); }
.ob-stats .stat strong { font-size: 1.6rem; }
.ob-stats .stat small { color: var(--text-muted); margin-left: 6px; }
.ob-bar { height: 6px; border-radius: 6px; background: var(--surface-alt); overflow: hidden; margin-top: 6px; }
.ob-bar i { display: block; height: 100%; background: var(--success); }
.ob-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; }
.ob-grid > * { min-width: 0; }
.ob-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 22px 12px; border: 2px dashed var(--border);
  border-radius: 14px; cursor: pointer; color: var(--text-muted); text-align: center; margin-bottom: 8px; }
.ob-drop .i { width: 28px; height: 28px; }
.ob-drop:hover, .ob-drop.over { border-color: var(--accent); color: var(--accent); }
.ob-doors { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.ob-import-result { margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--surface-alt); font-size: .85rem; }
.ob-import-result ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-muted); }
.ob-pending { border-color: var(--warning); }
.ob-pending li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.ob-pending li .tag-row { margin-left: auto; }
.ob-table td.actions { white-space: nowrap; }
.reg-home { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-alt); margin: 6px 0 12px; text-align: left; }
.reg-home img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.reg-home small { display: block; color: var(--text-muted); font-size: .78rem; }
.reg-home strong { font-size: 1.1rem; }
.code-input { font-family: var(--font-mono); font-size: 1.3rem; letter-spacing: .12em; text-align: center; text-transform: uppercase; }

/* ---- Comunidad: compartidos */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-alt);
  color: var(--text-muted); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip b { color: var(--text); }
.chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.chip.active b { color: var(--accent); }
.inc-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.inc-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.inc-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 320px; justify-content: flex-end; min-width: 0; }
.inc-filters select { width: auto; max-width: 100%; }
.inc-filters .am-search { flex: 1 1 180px; max-width: 320px; }
.inc-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pr-note { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-alt); border-left: 3px solid var(--warning); font-size: .88rem; }
.pr-note.ok { border-left-color: var(--success); }
.pr-req { padding: 10px 12px; border-radius: 10px; background: var(--surface-alt); margin: 8px 0 12px; font-size: .88rem; }
.pr-req summary { cursor: pointer; font-weight: 600; }

/* ---- Reportes vecinales */
.inc-hero { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.inc-hero h2 { margin: 0 0 4px; font-size: 1.15rem; }
.inc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.inc-card { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-alt); cursor: pointer; min-width: 0; }
.inc-card:hover, .inc-card:focus-visible { border-color: var(--accent); outline: none; }
.inc-thumb { width: 84px; height: 84px; flex: none; border-radius: 10px; background: var(--surface); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--text-muted); }
.inc-thumb .i { width: 30px; height: 30px; }
.inc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.inc-body h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.inc-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; color: var(--text-muted); margin-top: auto; }
.inc-meta span { display: inline-flex; gap: 8px; align-items: center; font-size: .8rem; }
.inc-meta .i { width: 15px; height: 15px; }
.inc-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.inc-cat input { position: absolute; opacity: 0; pointer-events: none; }
.inc-cat span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--border); border-radius: 12px; font-size: .78rem; text-align: center; cursor: pointer; background: var(--surface-alt); }
.inc-cat span .i { width: 24px; height: 24px; }
.inc-cat input:checked + span { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); font-weight: 700; }
.inc-cat input:focus-visible + span { outline: 2px solid var(--accent); }
.inc-timeline { list-style: none; padding: 0 0 0 14px; margin: 0; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.inc-timeline li { position: relative; font-size: .9rem; }
.inc-timeline li::before { content: ''; position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--border); }
.inc-timeline li.staff::before { background: var(--accent); }
.inc-timeline small { display: block; color: var(--text-muted); font-size: .75rem; }
.inc-reply { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* selector y galeria de fotos/video */
.mp { margin: 8px 0; }
.mp-label { font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.mp-label small { color: var(--text-muted); font-weight: 400; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 8px; }
.mp-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-alt); border: 1px solid var(--border); padding: 0; cursor: pointer; }
.mp-item img, .mp-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-tag { position: absolute; left: 4px; bottom: 4px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .68rem; padding: 2px 6px; border-radius: 6px; }
.mp-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.mp-x .i { width: 14px; height: 14px; }
.mp-doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; padding: 6px; text-align: center; font-size: .7rem; overflow-wrap: anywhere; }
.mp-loading { width: 100%; height: 100%; background: linear-gradient(90deg, var(--surface-alt), var(--surface), var(--surface-alt)); }

/* ---- Tramites */
.pr-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.pr-type { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-alt);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pr-type:hover { border-color: var(--accent); }
.pr-type .i { width: 26px; height: 26px; color: var(--accent); }
.pr-type small { color: var(--text-muted); font-size: .8rem; }
.pr-card { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.pr-card:last-child { border-bottom: 0; }
.pr-card h3 { margin: 4px 0 2px; font-size: 1rem; }
.pr-main { flex: 1; min-width: 0; }
.pr-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pr-files .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-decide { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---- Calendario */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { margin: 0 auto 0 4px; font-size: 1.15rem; min-width: 150px; order: -1; flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: .72rem; color: var(--text-muted); text-align: center; padding: 4px 0; font-weight: 700; text-transform: uppercase; }
.cal-cell { min-height: 92px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-alt); padding: 6px; display: flex; flex-direction: column; gap: 3px;
  text-align: left; font: inherit; color: var(--text); cursor: pointer; min-width: 0; overflow: hidden; }
.cal-cell.other { opacity: .45; }
.cal-cell.today .cal-n { background: var(--accent); color: #1a1408; border-radius: 999px; padding: 0 7px; }
.cal-cell.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-n { font-weight: 700; font-size: .85rem; align-self: flex-start; }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-chip { font-size: .68rem; padding: 1px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .78rem; color: var(--text-muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.maintenance { --cal: #5b8fe0; } .assembly { --cal: #b07ad8; } .fumigation { --cal: #d9822b; } .activity { --cal: #3fa66a; } .other { --cal: #8a93a0; } .booking { --cal: #c9962d; }
.cal-chip, .cal-dot { background: var(--cal); }
.cal-ev { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--border); border-left: 4px solid var(--cal);
  border-radius: 10px; background: var(--surface-alt); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
div.cal-ev { cursor: default; }
.cal-ev small { display: block; color: var(--text-muted); font-size: .78rem; }
.cal-ev-time { flex: none; min-width: 74px; font-size: .8rem; font-weight: 700; color: var(--text-muted); }
.cal-up { font-size: .9rem; margin: 16px 0 8px; color: var(--text-muted); }
.cal-badge { background: var(--cal); color: #fff; }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .cal-cell { min-height: 52px; padding: 4px; align-items: center; }
  .cal-items { display: none; }
  .cal-dots { display: flex; justify-content: center; }
  .cal-n { align-self: center; }
  .cal-grid { gap: 3px; }
}

/* ---- Areas comunes */
.am-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; margin-bottom: 16px; }
.am-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); min-width: 0; }
.am-card-head { display: flex; gap: 12px; align-items: flex-start; }
.am-card-head .i { width: 34px; height: 34px; color: var(--accent); flex: none; }
.am-card h3 { margin: 0; font-size: 1.05rem; }
.am-card p { margin: 0; }
.bk-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.bk-row:last-child { border-bottom: 0; }
.bk-row .grow { flex: 1; min-width: 180px; }
.bk-date { width: 52px; text-align: center; background: var(--surface-alt); border-radius: 10px; padding: 6px 0; flex: none; }
.bk-date b { display: block; font-size: 1.2rem; line-height: 1; }
.bk-date small { color: var(--text-muted); font-size: .72rem; text-transform: uppercase; }
.bk-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bk-days { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; margin: 8px 0 4px; }
.bk-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; margin: 8px 0; }
.bk-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); font: inherit; cursor: pointer; }
.bk-slot small { font-size: .7rem; color: var(--text-muted); text-align: center; overflow-wrap: anywhere; }
.bk-slot.free { border-color: var(--success); }
.bk-slot.free small { color: var(--success); }
.bk-slot.sel { background: var(--success); color: #fff; }
.bk-slot.sel small { color: #fff; }
.bk-slot.full, .bk-slot.blocked, .bk-slot.closed { background: transparent; text-decoration: line-through; opacity: .6; cursor: not-allowed; }
.bk-slot.past, .bk-slot.too_far { opacity: .45; cursor: not-allowed; }
.bk-slot.mine { border-color: var(--accent); opacity: 1; text-decoration: none; }
.ar-days { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-alt); font-size: .82rem; font-weight: 600; cursor: pointer; }
.chip-check input:checked + span { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); }

/* selects sueltos en barras de filtros (fuera de .field) */
.inc-filters select, .am-filters select, .am-bulk select, .panel-title select, .tag-row > select, .filters > select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .85rem;
}
.inc-filters select:focus, .am-filters select:focus, .am-bulk select:focus, .panel-title select:focus, .tag-row > select:focus { border-color: var(--accent); outline: none; }

/* ---- Facturacion */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; align-items: start; }
.inv-grid > * { min-width: 0; }
.inv-rules { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: .9rem; }
.inv-why { color: var(--warning); max-width: 320px; }
.inv-row .mono { font-size: .72rem; overflow-wrap: anywhere; }
.inv-status { display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; align-items: center; padding: 12px 16px; border-radius: 14px;
  margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface); }
.inv-status.ok { border-left: 5px solid var(--success); }
.inv-status.warn { border-left: 5px solid var(--warning); }
.inv-status .i { vertical-align: -3px; }
.inv-quota b { font-size: 1.3rem; }
.inv-quota small { color: var(--text-muted); }
.inv-h3 { font-size: .95rem; margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.inv-forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 6px 12px; }
.inv-forms label { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; color: var(--text-muted); }
.inv-forms select { padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .82rem; }
.inv-low { color: var(--danger); }
.fp-form .switch-row { margin-top: 8px; }

/* ---- Despliegue en sitio */
.dp { background: var(--bg); border-radius: 18px; padding: 8px 0; min-height: 70vh; display: flex; flex-direction: column; gap: 18px; }
.dp:fullscreen { padding: 32px; overflow: auto; }
.dp-head { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.dp-head h2 { margin: 0; font-size: 1.5rem; }
.dp-head p { margin: 2px 0 0; color: var(--text-muted); }
.dp-bar { grid-column: 1 / -1; height: 8px; border-radius: 8px; background: var(--surface-alt); overflow: hidden; }
.dp-bar i { display: block; height: 100%; background: var(--success); transition: width .4s; }
.dp-search { display: flex; align-items: center; gap: 12px; padding: 0 20px; border: 2px solid var(--accent); border-radius: 18px; background: var(--surface); }
.dp-search .i { width: 30px; height: 30px; color: var(--accent); flex: none; }
.dp-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1.7rem; font-weight: 600; padding: 18px 0; outline: none; }
.dp-hint { color: var(--text-muted); margin: 8px 4px 14px; }
.dp-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.dp-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; min-height: 110px; }
.dp-tile strong { font-size: 1.35rem; }
.dp-tile small { color: var(--text-muted); }
.dp-tile:hover, .dp-tile:focus-visible { border-color: var(--accent); outline: none; }
.dp-tile.off { opacity: .5; cursor: not-allowed; }
.dp-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 22px; }
.dp-card-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.dp-card-head h2 { margin: 0; font-size: 2rem; }
.dp-card-head p { margin: 0; color: var(--text-muted); }
.dp-main { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.dp-qr { background: #fff; border-radius: 18px; padding: 16px; text-align: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .18); }
.dp-qr img { width: min(340px, 70vw); height: min(340px, 70vw); display: block; image-rendering: pixelated; }
.dp-code { margin-top: 8px; font: 700 1.6rem var(--font-mono, monospace); letter-spacing: .18em; color: #1b1f24; }
.dp-steps { margin: 0; padding-left: 26px; display: grid; gap: 16px; font-size: 1.25rem; line-height: 1.4; }
.dp-live { margin-top: 18px; padding: 12px 16px; border-radius: 12px; background: var(--surface-alt); font-size: 1rem; }
.dp-live .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--success); animation: dp-pulse 1.4s infinite; margin-right: 6px; }
@keyframes dp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.dp-actions { margin-top: 14px; }
.dp-done { text-align: center; padding: 30px 10px; }
.dp-done .i { width: 72px; height: 72px; color: var(--success); }
.dp-done h3 { font-size: 1.8rem; margin: 10px 0; }
.dp-done.big { animation: arrival-in .4s ease-out; }
.dp-form { max-width: 560px; }
.dp-form input { font-size: 1.1rem; }
@media (max-width: 760px) {
  .dp-main { grid-template-columns: 1fr; justify-items: center; }
  .dp-steps { font-size: 1.05rem; }
  .dp-search input { font-size: 1.2rem; padding: 14px 0; }
  .dp-card-head h2 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) { .dp-live .dot { animation: none; } }

/* ---- viviendas: propietario y mascotas */
.reg-owner input[readonly] { background: var(--surface-alt); color: var(--text); font-weight: 600; cursor: default; }
.pets-sum { margin-bottom: 8px; }
.pets-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pets-form { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }
.cm-pets summary { cursor: pointer; padding: 6px 0; }
.cm-pets summary .i { width: 16px; height: 16px; vertical-align: -3px; }
.badge .i { width: 12px; height: 12px; vertical-align: -2px; }
/* ---- saldos iniciales */
.op-rules { margin: 0 0 12px; padding-left: 18px; }
.op-rules li { margin: 2px 0; }
.op-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 6px; }
.op-sum .stat { background: var(--surface-alt); border-radius: 12px; padding: 10px 12px; }
.op-sum .stat span { display: block; font-size: .78rem; color: var(--text-muted); }
.op-sum .stat strong { font-size: 1.2rem; }
.op-table { max-height: 50vh; overflow: auto; }
.op-err td { color: var(--danger, #c0392b); }
/* ---- depuracion */
.pg-warn { display: flex; gap: 12px; align-items: flex-start; border-left: 4px solid var(--danger, #c0392b); }
.pg-warn > .i { width: 22px; height: 22px; color: var(--danger, #c0392b); flex: none; margin-top: 2px; }
.pg-note { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-alt); margin-bottom: 10px; }
/* ---- modo prueba */
.trial-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 18px; background: color-mix(in srgb, var(--accent) 16%, var(--surface, #fff)); border-bottom: 1px solid var(--border); font-size: .9rem; }
.trial-banner strong { background: var(--accent); color: #1a1408; padding: 2px 10px; border-radius: 999px; font-size: .8rem; }
.trial-banner.soon strong { background: var(--danger, #c0392b); color: #fff; }
.trial-expired { position: fixed; inset: 0; z-index: 3000; background: rgba(10, 14, 20, .78); display: grid; place-items: center; padding: 20px; }
.trial-expired .panel { max-width: 440px; text-align: center; }
.cm-house-state { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: 14px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); }
.cm-house-state.off { border-color: var(--danger, #c0392b); background: color-mix(in srgb, var(--danger, #c0392b) 8%, transparent); }
/* ---- pruebas (demos) */
.tr-how { font-size: .92rem; line-height: 1.5; }
.tr-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.tr-card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.tr-card.pending { border-left: 4px solid var(--accent); }
.tr-card h3 { margin: 0; font-size: 1.05rem; }
.tr-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tr-who { font-size: .9rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tr-msg { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-alt); font-size: .9rem; }
.tr-foot { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.tr-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 10px; }
.tr-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; cursor: pointer; }
.tr-opt input { margin-top: 4px; }
.mytags li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
/* ---- sitio web (editor del super admin) */
.ws-tabs { margin-bottom: 12px; }
.ws-intro { font-size: .93rem; }
.ws-dirty { color: var(--warning, #b7791f); font-weight: 600; }
.ws-slug { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.ws-slug span { padding: 0 8px 0 12px; color: var(--text-muted); font-family: ui-monospace, monospace; font-size: .9rem; }
.ws-slug input { border: 0; border-radius: 0; flex: 1; min-width: 0; }
.ws-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1280px) { .ws-editor { grid-template-columns: minmax(0, 1fr) minmax(380px, 44%); } .ws-side { position: sticky; top: 12px; } }
.ws-side { display: none; }
@media (min-width: 1280px) { .ws-side { display: block; } }
.ws-preview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.seg-mini { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg-mini button { border: 0; background: var(--surface); padding: 6px 10px; cursor: pointer; color: var(--text-muted); }
.seg-mini button.on { background: var(--surface-alt); color: var(--text); }
.ws-frame { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; height: calc(100vh - 140px); }
.ws-frame iframe { width: 100%; height: 100%; border: 0; display: block; transform-origin: 0 0; }
.ws-frame.phone { max-width: 390px; margin-inline: auto; }
.ws-pagebar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; position: sticky; top: 0; z-index: 5; }
.ws-pagetitle { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ws-state { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.ws-state.ok { color: var(--success, #1d7a46); }
.ws-state.warn { color: var(--warning, #b7791f); }
.ws-state.err { color: var(--danger, #c0392b); }
.ws-meta summary { cursor: pointer; }
.ws-meta[open] summary { margin-bottom: 12px; }
.ws-block { position: relative; padding: 0; margin-bottom: 22px; overflow: visible; }
.ws-block.off { opacity: .6; }
.ws-bhead { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.ws-btoggle { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; background: none; border: 0; text-align: left; cursor: pointer; color: var(--text); padding: 4px; font: inherit; }
.ws-btoggle span:last-child { display: flex; flex-direction: column; min-width: 0; }
.ws-btoggle small { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-bico { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-alt); flex: none; }
.ws-bacts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ws-bacts .btn-icon { position: relative; }
.ws-slash { position: absolute; left: 50%; top: 50%; width: 20px; height: 2px; background: currentColor; transform: translate(-50%, -50%) rotate(-45deg); }
.ws-bbody { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.ws-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ws-fields > .field, .ws-fields > .ws-list, .ws-fields > .ws-group { grid-column: 1 / -1; margin-bottom: 10px; }
.ws-fields > .field.half { grid-column: auto; }
.ws-fields textarea.mono { font-family: ui-monospace, monospace; font-size: .85rem; }
.ws-more summary { cursor: pointer; color: var(--text-muted); font-size: .9rem; margin: 6px 0; }
.ws-media-row { display: flex; gap: 8px; align-items: center; }
.ws-media-row input { flex: 1; min-width: 0; }
.ws-thumb { width: 64px; height: 44px; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-alt); display: grid; place-items: center; font-size: .7rem; text-align: center; }
.ws-thumb img, .ws-thumb video { width: 100%; height: 100%; object-fit: cover; }
.ws-icon-row { display: flex; gap: 8px; align-items: center; }
.ws-icon-row input { flex: 1; min-width: 0; }
.ws-list { border: 1px dashed var(--border); border-radius: 12px; padding: 10px; }
.ws-list-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.ws-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px 0; margin-bottom: 8px; background: var(--surface); }
.ws-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: .85rem; color: var(--text-muted); text-transform: capitalize; }
.ws-group { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; }
.ws-group legend { font-weight: 600; padding: 0 6px; }
.ws-insert { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); z-index: 2; border: 1px dashed var(--border); background: var(--bg, #f4f5f7); color: var(--text-muted); border-radius: 999px; font-size: .78rem; padding: 3px 12px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.ws-block:hover .ws-insert, .ws-insert:focus-visible { opacity: 1; }
.ws-add { margin-top: 6px; border-style: dashed; }
.modal.modal-wide { max-width: 860px; width: calc(100vw - 32px); }
.ws-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; max-height: 70vh; overflow: auto; }
.ws-pick { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 2px 10px; text-align: left; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.ws-pick:hover { border-color: var(--accent); }
.ws-pick .ws-bico { grid-row: 1 / 3; }
.ws-pick small { color: var(--text-muted); font-size: .8rem; line-height: 1.3; }
.ws-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.ws-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 50vh; overflow: auto; margin-top: 12px; }
.ws-libitem { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--surface); cursor: pointer; margin: 0; color: var(--text); font: inherit; text-align: left; }
.ws-libitem img, .ws-libitem video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--surface-alt); }
.ws-libitem small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; color: var(--text-muted); }
.ws-libitem figcaption { display: flex; flex-direction: column; gap: 6px; }
.ws-up { margin-bottom: 8px; }
.ws-savebar { position: sticky; bottom: 0; display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.ws-domain code { background: var(--surface-alt); padding: 1px 6px; border-radius: 6px; }
@media (max-width: 640px) { .ws-fields { grid-template-columns: 1fr; } .ws-bacts .btn-icon { padding: 6px; } .ws-insert { opacity: 1; } }
/* ---- tags por CSV */
.tb-sum { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 8px; font-size: .9rem; }
.tb-sum .err { color: var(--danger); }
.tb-table { max-height: 50vh; overflow: auto; }
.tb-table tr.error td { color: var(--danger); }
.tb-table tr.replaced td { opacity: .6; }
.tb-hist { margin-top: 12px; }
.tb-hist summary { cursor: pointer; color: var(--text-muted); }
/* ---- registro de jornada y home office */
.lr-head { display: flex; gap: 12px; align-items: flex-start; border-left: 4px solid var(--success); }
.lr-head.bad { border-left-color: var(--danger); }
.lr-head > .i { width: 26px; height: 26px; flex: none; color: var(--success); }
.lr-head.bad > .i { color: var(--danger); }
.lr-warn { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warning, #b7791f) 12%, transparent); margin-bottom: 12px; }
.ho-map { height: 260px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.ho-req { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; border-radius: 12px; background: var(--surface-alt); margin-bottom: 10px; }
.pr-day { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; margin-bottom: 8px; }
.pr-lbl { display: flex; flex-direction: column; }
.pr-bar { position: relative; height: 18px; border-radius: 6px; background: var(--surface-alt); overflow: hidden; }
.pr-bar i { position: absolute; top: 0; bottom: 0; }
.pr-bar i.active { background: var(--success); }
.pr-bar i.idle { background: var(--text-muted); opacity: .45; }
.ci-card { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.ci-clock { font: 700 2.6rem/1 var(--font-mono, ui-monospace, monospace); letter-spacing: .02em; }
.ci-loc { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: .92rem; color: var(--text-muted); }
.ci-loc.ok { color: var(--success); }
.ci-loc.warn { color: var(--warning, #b7791f); }
.ci-cam { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; max-width: 360px; margin-inline: auto; width: 100%; }
.ci-cam video, .ci-cam img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
@media (max-width: 640px) { .pr-day { grid-template-columns: 1fr; } }
/* ---- camara de evidencia */
.dc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.dc-shot { margin: 0; }
.dc-shot img, .dc-err { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; background: var(--surface-alt); display: block; }
.dc-err { display: flex; align-items: center; justify-content: center; padding: 6px; font-size: .75rem; color: var(--danger); text-align: center; }
.dc-shot figcaption { font-size: .72rem; color: var(--text-muted); margin-top: 3px; }
/* ---- conciliacion bancaria */
.rc-drop { border: 2px dashed var(--border); border-radius: 14px; padding: 18px; display: flex; gap: 10px; align-items: center; justify-content: center; cursor: pointer; margin: 12px 0; color: var(--text-muted); }
.rc-drop.over { border-color: var(--primary); background: var(--surface-alt); }
.rc-prog { height: 6px; border-radius: 4px; background: var(--surface-alt); overflow: hidden; width: 120px; margin-bottom: 3px; }
.rc-prog i { display: block; height: 100%; background: var(--success); }
.rc-check { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; margin: 8px 0 12px; background: color-mix(in srgb, var(--success) 10%, transparent); }
.rc-check.bad { background: color-mix(in srgb, var(--warning, #b7791f) 14%, transparent); }
.rc-check > .i { width: 22px; height: 22px; flex: none; }
.rc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.rc-kpis > div { background: var(--surface-alt); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.rc-kpis b { font-size: 1.4rem; }
.rc-kpis span { font-size: .78rem; color: var(--text-muted); }
.rc-kpis .g b { color: var(--success); } .rc-kpis .y b { color: var(--warning, #b7791f); } .rc-kpis .r b { color: var(--danger); }
.rc-table tr.rc-green td:first-child { box-shadow: inset 3px 0 var(--success); }
.rc-table tr.rc-yellow td:first-child { box-shadow: inset 3px 0 var(--warning, #b7791f); }
.rc-table tr.rc-red td:first-child { box-shadow: inset 3px 0 var(--danger); }
.rc-table .neg { color: var(--danger); }
.rc-sug { margin-top: 4px; font-size: .8rem; padding: 4px 8px; border-radius: 8px; background: var(--surface-alt); display: inline-block; }
.rc-missing { border-color: var(--danger) !important; }
.rc-receipts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 10px; }
.rc-rcp { display: grid; grid-template-columns: 90px 1fr; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; }
.rc-rcp.skipped { opacity: .5; } .rc-rcp.imported { opacity: .7; }
.rc-thumb { width: 90px; height: 120px; border-radius: 8px; background: var(--surface-alt) center / cover no-repeat; cursor: zoom-in; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rc-fields { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rc-fields small.mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-fields .form-row { gap: 6px; } .rc-fields input { padding: 6px 8px; }

/* ---- v16: padron del hogar (condicion, habitantes, autos), secciones, usuarios por hogar, envio desde despliegue */
.hh-occ { display: flex; gap: 4px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.hh-opt { flex: 1; min-width: 0; background: none; border: 0; border-radius: 8px; padding: 9px 6px; cursor: pointer; color: var(--text-muted); font: inherit; font-size: 0.88rem; }
.hh-opt.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); font-weight: 600; }
.hh-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hh-counts .field-help { font-size: .74rem; }
.field-label-sm { font-size: .78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 6px 0 4px; }
.cm-sec { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 4px; margin: 6px 0 14px; background: var(--surface-alt); }
.cm-sec-title { font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.cm-log li { font-size: .86rem; }
.sc-list li { align-items: center; }
.sc-add { display: flex; gap: 8px; margin-top: 10px; }
.sc-add input { flex: 1; min-width: 0; }
.sc-ren { margin: 0; width: 100%; flex-wrap: wrap; }
.ob-veh { border-top: 1px solid var(--border); margin-top: 14px; }
/* usuarios agrupados por seccion y hogar */
.ug-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.ug-tools .am-search { flex: 1; min-width: 200px; }
.ug-sec { margin-top: 14px; }
.ug-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; font-weight: 700; }
.ug-sec > summary::-webkit-details-marker { display: none; }
.ug-sec > summary::before { content: '›'; display: inline-block; transition: transform .15s; font-size: 1.2rem; line-height: 1; }
.ug-sec[open] > summary::before { transform: rotate(90deg); }
.ug-sec > summary small { font-weight: 500; color: var(--text-muted); margin-left: auto; }
.ug-house { border: 1px solid var(--border); border-radius: 10px; margin: 8px 0 0 12px; overflow: hidden; }
.ug-house-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ug-house-head strong { font-size: .95rem; }
.ug-house-head small { color: var(--text-muted); }
.ug-house table { margin: 0; }
.ug-house td, .ug-house th { font-size: .88rem; }
@media (max-width: 640px) { .ug-house { margin-left: 0; } .hh-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* despliegue: mandar el link */
.dp-send { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.dp-send form { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface); }
.dp-send label { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.dp-send .dp-in { display: flex; gap: 8px; }
.dp-send .dp-in span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-alt); font-weight: 700; }
.dp-send input { flex: 1; min-width: 0; font-size: 1.1rem; padding: 12px; }
.dp-send .field-help { font-size: .8rem; }
@media (max-width: 760px) { .dp-send { grid-template-columns: 1fr; } }

/* ---- v17: saldos iniciales en desglose y recargos por mora */
.op-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.op-mode-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--surface); }
.op-mode-opt input { width: auto; margin-top: 3px; }
.op-mode-opt span { display: flex; flex-direction: column; gap: 2px; }
.op-mode-opt small { color: var(--text-muted); font-size: .8rem; }
.op-mode-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.op-sum .stat small { display: block; color: var(--text-muted); font-size: .76rem; margin-top: 2px; }
@media (max-width: 640px) { .op-mode { grid-template-columns: 1fr; } }
.fin-late { font-size: .82rem; color: var(--text-muted); margin-top: 3px; }
.fin-late strong { color: var(--danger, #d9534f); }
.fin-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-alt); }
.fin-total span { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; }
.fin-total strong { font-size: 1.35rem; margin-left: auto; }
.fin-total small { flex-basis: 100%; color: var(--text-muted); }

/* ---- v18: pago anticipado, hogar critico */
.pp-quote { margin: 4px 0 12px; }
.pp-rows { border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; background: var(--surface-alt); }
.pp-rows > div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.pp-rows > div:last-child { border-bottom: 0; }
.pp-rows span { color: var(--text-muted); }
.pp-disc strong { color: var(--success, #2e9e5b); }
.pp-total strong { font-size: 1.15rem; }
.crit-banner { background: color-mix(in srgb, var(--danger, #c0392b) 12%, var(--surface, #fff)); }
.crit-banner strong { background: var(--danger, #c0392b); color: #fff; }
.cm-crit { flex-wrap: wrap; }

/* ---- v19: bitacora de tags (ZKTeco) */
.tl-filters { flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.tl-filters .field { margin: 0; min-width: 150px; }
.tl-filters .tl-q { flex: 1; min-width: 180px; }
.tl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.tl-kpis .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.tl-kpis .stat span { font-size: .78rem; color: var(--text-muted); }
.tl-kpis .stat strong { font-size: 1.5rem; line-height: 1.2; }
.tl-kpis .stat small { align-self: flex-start; }
.tl-kpis .stat.warn strong { color: var(--danger, #c0392b); }
.tl-tops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.tl-top { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); min-width: 0; }
.tl-top h4 { margin: 0 0 8px; font-size: .9rem; }
.tl-top ol { margin: 0; padding: 0; list-style: none; counter-reset: tl; display: flex; flex-direction: column; gap: 8px; }
.tl-top li { counter-increment: tl; display: flex; align-items: flex-start; gap: 8px; font-size: .86rem; }
.tl-top li::before { content: counter(tl) "."; color: var(--text-muted); min-width: 16px; padding-top: 1px; }
.tl-top li > span:first-of-type { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tl-top li .tl-n { font-weight: 700; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.tl-top small { color: var(--text-muted); }
.tl-top .link-btn, .tl-table .link-btn { margin: 0; padding: 0; font-size: .86rem; color: var(--text); }
.tl-table tr.tl-denied td:first-child { box-shadow: inset 3px 0 0 var(--danger, #c0392b); }
.tl-table tr.tl-alarm { background: color-mix(in srgb, var(--danger, #c0392b) 8%, transparent); }
@media (max-width: 900px) { .tl-tops { grid-template-columns: 1fr; } .tl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
