/* ComunityWork — estilos base. El color de acento lo define cada conglomerado (--accent). */
:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --border: #e5e5e0;
  --text: #1b1b19;
  --muted: #6b6b65;
  --accent: #2f5d50;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --accent-text: var(--accent-ink, var(--accent));
  --danger: #b42318;
  --warn: #a15c07;
  --ok: #067647;
  --radius: 10px;
  /* Leve sombra para que los logotipos se despeguen del color de fondo */
  --logo-shadow: drop-shadow(0 1px 1px rgba(0, 0, 0, .28)) drop-shadow(0 3px 6px rgba(0, 0, 0, .22));
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  /* Sombra muy sutil para cajas y menú */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 6px rgba(16, 24, 40, .04);
  --shadow-side: 1px 0 6px rgba(16, 24, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --border: #2e2e2b;
    --text: #ececea; --muted: #9b9b95; --danger: #f97066; --warn: #fdb022; --ok: #47cd89;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .18);
    --shadow-side: 1px 0 6px rgba(0, 0, 0, .3);
    --accent-soft: color-mix(in srgb, var(--accent) 24%, transparent);
    --accent-text: color-mix(in srgb, var(--accent) 45%, #fff);
    color-scheme: dark;
  }
}
/* Tema elegido manualmente con el botón (prevalece sobre el del sistema) */
:root[data-theme="dark"] {
  --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --border: #2e2e2b;
  --text: #ececea; --muted: #9b9b95; --danger: #f97066; --warn: #fdb022; --ok: #47cd89;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .18);
  --shadow-side: 1px 0 6px rgba(0, 0, 0, .3);
  --accent-soft: color-mix(in srgb, var(--accent) 24%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 45%, #fff);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  /* Textos: Montserrat Regular (los botones y nombres en listas usan pesos mayores para destacar) */
  font: 400 14px/1.5 Montserrat, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
strong, b { font-weight: 600; }
/* Fondo con textura (img/fondo.jpg) al 30% de opacidad, fijo detrás de todo el contenido */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("../img/fondo.jpg") center / cover no-repeat; opacity: .3;
}
/* En modo oscuro la textura se invierte para que no aclare el fondo */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { filter: invert(1); opacity: .25; } }
:root[data-theme="dark"] body::before { filter: invert(1); opacity: .25; }
a { color: inherit; text-decoration: none; }
/* Títulos: Montserrat Bold con interlineado 1,5 */
h1, h2, h3, .brand-name { font-family: Montserrat, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 700; line-height: 1.5; }
h1, h2, h3 { margin: 0; letter-spacing: -.005em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 15px; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- Utilidades ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.min0 { min-width: 0; }
.mt { margin-top: 20px; } .mt-sm { margin-top: 8px; } .mb { margin-bottom: 20px; } .mb-sm { margin-bottom: 10px; }
.center { text-align: center; }
.w-full { width: 100%; justify-content: center; }
.meta { font-size: 13px; color: var(--muted); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link { font-size: 13px; color: var(--accent-text); font-weight: 500; }
.link:hover { text-decoration: underline; }
.clickable { cursor: pointer; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); font-size: 13px; }
.pre { white-space: pre-wrap; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px;
  box-shadow: var(--shadow-side); z-index: 5;
  overflow-x: hidden; overflow-y: auto; /* en pantallas bajas el menú se desplaza en vez de cortarse */
}
/* Alto fijo: el logo y el botón del menú no se mueven al abrir o cerrar el menú */
.brand { display: flex; align-items: flex-start; gap: 10px; padding: 0 8px 18px; height: 52px; box-sizing: border-box; flex-shrink: 0; }
/* El logo (34 px) queda centrado a la misma altura que la barra superior (selector de centro, buscador, lupa) */
:root { --topbar-h: 60px; }
.sidebar { padding-top: calc((var(--topbar-h) - 34px) / 2) !important; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--on-accent, #fff);
  display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.25; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--muted); font-size: 14px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.count { margin-left: auto; background: var(--accent); color: var(--on-accent, #fff); font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 7px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 6px 0; display: flex; align-items: center; gap: 10px; }
/* Burbujas de novedades del menú + interruptor para mostrarlas u ocultarlas */
.nav-bubble { box-shadow: 0 0 0 2px var(--surface); animation: bubble-in .25s ease-out; }
@keyframes bubble-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.badge-switch { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.badge-switch + .side-foot { margin-top: 0; }
.badge-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.badge-switch .sw { position: relative; width: 34px; height: 20px; border-radius: 99px; background: var(--border); flex-shrink: 0; transition: background .15s; }
.badge-switch .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.badge-switch input:checked + .sw { background: var(--accent); }
.badge-switch input:checked + .sw::after { transform: translateX(14px); }
.badge-switch input:focus-visible + .sw { box-shadow: 0 0 0 3px var(--accent-soft); }
.shell.rail .badge-switch { justify-content: center; padding: 10px 0; }
.shell.rail .badge-switch > span:first-child { display: none; }
/* ---- CP Flow: botón en el ingreso, panel de clientes y modo incógnito ---- */
.cp-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.cp-btn { gap: 8px; font-weight: 600; }
.cp-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #1d1c1b; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
[data-theme="dark"] .cp-dot { background: #ececea; color: #1d1c1b; }
.login-logo { display: grid; place-items: center; background: var(--accent); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.login-logo img { max-width: 100%; max-height: 84px; object-fit: contain; filter: var(--logo-shadow); }
.cp-panel { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.cp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.cp-client h2 { font-size: 18px; }
.cp-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cp-stats > div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.cp-stats strong { display: block; font-size: 22px; line-height: 1.1; }
.cp-stats span { font-size: 12.5px; color: var(--muted); }
/* Vista del logotipo sobre el color del cliente: siempre completo (sin recortes) */
.cp-logo-prev { display: flex; align-items: center; justify-content: center; width: 140px; height: 72px; border-radius: 12px; padding: 8px; flex-shrink: 0; box-sizing: border-box; }
.cp-logo-prev img { display: block; width: 100%; height: 100%; object-fit: contain; filter: var(--logo-shadow); }
.cp-logo-prev.sm { width: 104px; height: 60px; padding: 7px; border-radius: 10px; }
.cp-logo-prev.xs { width: 64px; height: 40px; padding: 5px; border-radius: 8px; }
/* Enlace de ingreso de cada cliente */
.cp-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.cp-link-url { display: block; font-size: 13px; font-weight: 500; color: var(--accent-text); word-break: break-all; text-decoration: none; }
.cp-link-url:hover { text-decoration: underline; }
/* Selector cuadros / lista */
.seg-toggle { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg-toggle button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg-toggle button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.cp-table td { vertical-align: middle; }
.cp-table .btn-icon { width: 34px; height: 34px; }
.cp-incognito { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 32px; background: #1d1c1b; color: #fff; font-size: 13px; }
.cp-incognito > span { display: inline-flex; align-items: center; gap: 8px; }
.cp-incognito .cp-dot { background: #fff; color: #1d1c1b; }
@media (max-width: 900px) { .cp-incognito { padding: 8px 12px; } }
/* Firma de la persona de la administración que escribió el mensaje */
.msg-by { font-size: 11.5px; font-weight: 600; color: var(--accent-text); margin-bottom: 3px; white-space: normal; }
/* Mensajes: listas para iniciar conversación */
.msg-pickers { display: grid; gap: 6px; padding: 10px 14px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.msg-pick { height: 36px; font-size: 13px; padding: 0 10px; width: 100%; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who strong { display: block; font-size: 13px; font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 32px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.topbar .search { width: 100%; max-width: 420px; }
.topbar .cg { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.content { padding: 28px 32px 48px; width: 100%; max-width: 1180px; }
.content-mensajes { max-width: none; padding-bottom: 28px; }
.btn.back-btn { display: none; }
/* Inicio adaptable */
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.home-block { min-width: 0; grid-column: span 2; }
.home-block.size-half { grid-column: span 1; }
.home-block.editing { outline: 2px dashed var(--border); outline-offset: 4px; border-radius: 12px; cursor: grab; }
.home-block.is-hidden .home-body-in > :not(.home-bar) { opacity: .35; }

/* ---- Achicar / expandir módulos del inicio ----
   El contenido se pliega con una animación de altura (grid 1fr → 0fr) y aparece una barra compacta con su nombre. */
.home-block { position: relative; }
.home-body { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; min-width: 0; opacity: 1; transition: grid-template-rows .45s cubic-bezier(.22, 1, .36, 1), opacity .3s ease; }
.home-body-in { min-height: 0; min-width: 0; }
@media (max-width: 600px) { .home-bar { flex-wrap: wrap; row-gap: 2px; } .home-bar strong { flex-basis: calc(100% - 30px); } }
.home-block.collapsed .home-body { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
.home-block.collapsed .home-body-in, .home-block.animating .home-body-in { overflow: hidden; }
/* Barra compacta del módulo achicado */
.home-mini { display: flex; align-items: center; gap: 10px; padding: 0 16px; max-height: 0; opacity: 0; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid transparent; border-radius: var(--radius); box-shadow: none;
  transition: max-height .45s cubic-bezier(.22, 1, .36, 1), opacity .3s ease, padding .45s cubic-bezier(.22, 1, .36, 1), transform .2s ease, border-color .2s; }
.home-block.collapsed .home-mini { max-height: 64px; opacity: 1; padding: 14px 16px; border-color: var(--border); box-shadow: var(--shadow-sm); }
.home-block:not(.collapsed) .home-mini { pointer-events: none; }
.home-mini strong { font-family: Montserrat, Inter, sans-serif; font-weight: 700; font-size: 15px; }
.home-mini svg { transform: rotate(180deg); color: var(--muted); }
.home-block.collapsed .home-mini:hover { transform: scale(1.01); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
/* Botón flotante para achicar: aparece al pasar el mouse (siempre visible en pantallas táctiles) */
.home-toggle { position: absolute; top: -10px; right: -10px; z-index: 3; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border); box-shadow: var(--shadow-sm); cursor: pointer; padding: 0;
  opacity: 0; transform: scale(.7); transition: opacity .2s ease, transform .25s cubic-bezier(.34, 1.56, .64, 1), color .15s; }
.home-block:hover .home-toggle, .home-toggle:focus-visible { opacity: 1; transform: scale(1); }
.home-toggle:hover { color: var(--accent-text); transform: scale(1.1) !important; }
.home-block.collapsed .home-toggle { opacity: 0 !important; pointer-events: none; }
@media (hover: none) { .home-toggle { opacity: .9; transform: scale(1); top: -8px; right: -6px; } }
/* Íconos de ancho (cuadrado = media columna, rectángulo = ancho completo) */
.home-sizes { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.home-sizes .btn-icon { width: 28px; height: 26px; color: var(--muted); }
.home-sizes .btn-icon.on { background: var(--accent-soft); color: var(--accent-text); }
/* Costado derecho arrastrable para cambiar el ancho */
.home-resize { display: none; }
@media (min-width: 901px) {
  .home-block.editing .home-resize { display: block; position: absolute; top: 12px; bottom: 12px; right: -11px; width: 14px; z-index: 4; cursor: ew-resize; touch-action: none; }
  .home-resize::after { content: ""; position: absolute; left: 5px; top: 50%; width: 4px; height: 44px; margin-top: -22px; border-radius: 4px; background: var(--border); transition: background .15s, height .2s, margin .2s; }
  .home-resize:hover::after, .home-block.resizing .home-resize::after { background: var(--accent); height: 64px; margin-top: -32px; }
}
.home-block.resizing { z-index: 5; transition: none; outline-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); border-radius: 12px; }
.home-block.resizing.will-full { outline-style: solid; }
body.is-resizing { cursor: ew-resize; user-select: none; }
/* Celular: mantener presionado un módulo para levantarlo y moverlo */
.home-block.editing { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.home-block.lifted { position: relative; z-index: 6; box-shadow: var(--shadow); border-radius: 12px; opacity: .95; transition: none; }
body.is-touch-dragging { overflow: hidden; }

/* Transición fluida al reordenar o cambiar el ancho (navegadores con View Transitions) */
::view-transition-group(*) { animation-duration: .38s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
@media (prefers-reduced-motion: reduce) { .home-body, .home-mini, .home-toggle { transition: none; } }
.home-block.dragging { opacity: .5; }
.home-block.drop-target { outline-color: var(--accent); }
.home-bar { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; padding: 4px 6px; background: var(--surface-2); border-radius: 8px; font-size: 13px; }
.home-grip { color: var(--muted); padding: 0 4px; font-size: 16px; line-height: 1; }
@media (max-width: 900px) { .home-block.size-half { grid-column: span 2; } }
.cat-actions .btn-icon { width: 32px; height: 32px; }
.cat-actions .btn-icon:disabled { opacity: .3; }
.btn.menu-btn { flex-shrink: 0; margin-left: -6px; }

/* Menú en modo franja (solo íconos): escritorio cuando se oculta, celular cuando está cerrado */
.shell { transition: grid-template-columns .2s ease; }
.shell.rail { grid-template-columns: 56px 1fr; }
/* Solo cambia el margen lateral: el margen superior es el mismo abierto y cerrado, así el logo no se mueve */
.shell.rail .sidebar { padding-left: 6px; padding-right: 6px; overflow-x: hidden; overflow-y: auto; }
.sidebar .nav a { position: relative; }
.shell.rail .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.shell.rail .brand > .min0,
.shell.rail .nav a > span:not(.count),
.shell.rail .side-foot .who { display: none; }
.shell.rail .nav-label { font-size: 0; padding: 0; height: 1px; background: var(--border); margin: 8px 6px; }
.shell.rail .nav a { justify-content: center; padding: 10px 0; }
.shell.rail .nav a .count { position: absolute; top: 2px; right: 2px; margin: 0; padding: 0 5px; font-size: 10px; line-height: 16px; min-width: 16px; text-align: center; }
.shell.rail .side-contact { font-size: 0; gap: 0; justify-content: center; padding: 0; width: 44px; height: 40px; min-height: 40px; margin: 10px auto; }
.shell.rail .side-foot { flex-direction: column; gap: 6px; padding: 10px 0 0; }
.nav-scrim { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.back:hover { color: var(--text); }

/* ---------- Componentes ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, filter .15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: transparent; color: #fff; }
.badge.badge-centro { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 500; }
.btn-danger-solid:hover { filter: brightness(.95); }
/* Ventana de confirmación propia (reemplaza confirm/prompt del navegador) */
.dlg-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .4); display: grid; place-items: center; padding: 16px; }
.dlg { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; }
.dlg h2 { font-size: 17px; margin-bottom: 8px; }
.dlg-msg { color: var(--muted); margin: 0 0 14px; }
.dlg .input { margin-bottom: 14px; }
.dlg .form-foot { margin-top: 4px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 34px; padding: 0; justify-content: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.alert-box, .inc-quick { box-shadow: var(--shadow-sm); }
a.card, .card.clickable { transition: border-color .15s, box-shadow .15s; }
a.card:hover, .card.clickable:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: var(--shadow); }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; }

.input {
  width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); padding: 0 12px; font: inherit; font-size: 14px;
}
textarea.input { height: auto; min-height: 104px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 28px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 35px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar select.input { width: auto; min-width: 170px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; color: var(--muted); cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Las pestañas se pueden deslizar a lo ancho en pantallas chicas, pero sin flechas ni barra de desplazamiento visibles */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 12px; font-size: 14px; color: var(--muted); background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }

.avatar { display: grid; place-items: center; border-radius: 8px; font-weight: 600; color: #fff; flex-shrink: 0; letter-spacing: .02em; }

.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover .li-title, .list-item.clickable:hover .li-title { color: var(--accent-text); }
.li-title { font-weight: 500; font-size: 14px; line-height: 1.35; }

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge-alta { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.badge-media { background: color-mix(in srgb, var(--warn) 13%, transparent); color: var(--warn); }
.badge-ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }

.company-card .row { align-items: center; }
.service-card { display: flex; flex-direction: column; gap: 6px; }
.service-card .row { margin-top: auto; padding-top: 6px; }

.profile-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.profile-head .desc { margin-top: 10px; max-width: 640px; }
.contact-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.contact-row > * { display: inline-flex; align-items: center; gap: 6px; }
.contact-row a:hover { color: var(--accent-text); }
.body-text { margin: 14px 0 18px; white-space: pre-wrap; line-height: 1.6; }

.aviso { display: flex; gap: 14px; }
.aviso-mark { width: 4px; border-radius: 4px; background: var(--border); flex-shrink: 0; }
.aviso-mark.t-mantencion { background: var(--warn); }
.aviso-mark.t-seguridad { background: var(--danger); }
.aviso-mark.t-evento { background: var(--accent); }
.aviso-mark.t-aviso { background: var(--muted); }

/* Tabla (administración) */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 40px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-val { text-align: right; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* ---------- Mensajes ---------- */
.chat {
  display: grid; grid-template-columns: 320px 1fr; height: calc(100dvh - 60px - 56px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.conv-list { border-right: 1px solid var(--border); overflow-y: auto; }
.conv-list-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.conv { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: center; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--accent-soft); }
.conv .top { display: flex; justify-content: space-between; gap: 8px; }
.conv .name { font-weight: 500; font-size: 13px; }
.conv.unread .name, .conv.unread .last { font-weight: 600; color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-head { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.thread-back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: min(72%, 560px); padding: 8px 12px; border-radius: 14px; background: var(--surface-2); line-height: 1.45; word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--accent); color: var(--on-accent, #fff); border-bottom-right-radius: 4px; }
.msg:not(.mine) { border-bottom-left-radius: 4px; }
.msg time { display: block; font-size: 11px; opacity: .65; margin-top: 2px; text-align: right; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.thread-empty { flex: 1; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 24px; }

/* ---------- Modal, toast, login ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 15, 14, .4); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 540px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); border: 1px solid var(--border); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 14px; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
@keyframes fade { from { opacity: 0; } }

#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(6px); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 440px; padding: 28px; }
.login-card .brand { padding: 0 0 8px; }
.pick { max-height: 232px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.pick-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--border); text-align: left; }
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--surface-2); }
.pick-item.selected { background: var(--accent-soft); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  /* Menú en celular: cerrado = franja de íconos (funcionan); abierto = menú completo encima del contenido */
  .shell, .shell.rail { grid-template-columns: 1fr; padding-left: 56px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: 56px; z-index: 40; padding: 16px 6px;
    overflow-x: hidden; overflow-y: auto; transition: width .2s ease; }
  .shell.nav-open .sidebar { width: min(264px, 85vw); padding-left: 12px; padding-right: 12px; box-shadow: var(--shadow); }
  .sidebar .nav a { position: relative; }
  .sidebar .nav a > span:not(.count) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-contact { white-space: normal; height: auto; min-height: 36px; text-align: left; }
  .shell.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 30; }
  .btn.menu-btn, .btn.back-btn { display: inline-flex; flex-shrink: 0; }
  .topbar { padding: 0 16px; }
  .topbar .cg { display: none; }
  .content { padding: 20px 16px 40px; }
  .content-mensajes { padding: 12px 16px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 60px - 28px); }
  .chat.has-thread .conv-list { display: none; }
  .chat:not(.has-thread) .thread { display: none; }
  .thread-back { display: inline-flex; }
  .msg { max-width: 85%; }
  .bar-row { grid-template-columns: 110px 1fr 32px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 10px; }
}
@media (max-width: 520px) {
  .grid-4 { gap: 10px; }
  .stat .value { font-size: 22px; }
  .page-head .row { width: 100%; }
  .page-head .row .btn { flex: 1; justify-content: center; }
}

/* ---------- Imágenes ---------- */
.avatar-logo { background: #fff; border: 1px solid var(--border); overflow: hidden; }
.avatar-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.uploader { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.uploader label.btn, .composer label.btn { cursor: pointer; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; cursor: pointer; }
.thumb-lg { width: 100%; height: auto; aspect-ratio: 1; }
.thumb-add { cursor: pointer; color: var(--muted); border-style: dashed; }
.thumb-add:hover { color: var(--accent-text); border-color: var(--accent); }
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.gallery-sm { grid-template-columns: repeat(auto-fill, 88px); margin: 8px 0; }
.gimg { padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; cursor: zoom-in; background: var(--surface-2); display: block; width: 100%; }
.gimg img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gimg:hover img { transform: scale(1.03); }
.service-card .cover { margin: -18px -18px 6px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-2); }
.service-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; margin: -2px -6px 6px; width: min(300px, 60vw); }
.msg-imgs .gimg { border: 0; border-radius: 10px; }
.msg-report { display: none; background: none; border: 0; padding: 0; margin-top: 2px; font-size: 11px; color: var(--muted); cursor: pointer; }
.msg:hover .msg-report, .msg:focus-within .msg-report { display: block; }
.composer-wrap { border-top: 1px solid var(--border); }
.composer-wrap .composer { border-top: 0; }
.composer-thumbs { padding: 12px 12px 0; }
.lightbox { background: rgba(0, 0, 0, .86); }
.lightbox img { max-width: 94vw; max-height: 86vh; border-radius: 8px; box-shadow: var(--shadow); }
.lightbox .btn { position: fixed; top: 16px; right: 16px; background: rgba(255, 255, 255, .14); color: #fff; border: 0; }

/* ---------- Moderación ---------- */
.report-link { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; font-size: 12px; color: var(--muted); cursor: pointer; }
.report-link:hover { color: var(--danger); }
.quote { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface-2); margin: 12px 0; }
.tab .count { font-size: 11px; }

/* ---------- Barra superior: tema y notificaciones ---------- */
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar .cg + .top-actions { margin-left: 8px; }
.bell-wrap { position: relative; }
.bell { position: relative; }
.bell-count { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 30; overflow: hidden; }
/* Celular: el panel se ancla a la barra superior (no a la campana) para no quedar bajo la franja de íconos */
@media (max-width: 900px) {
  .bell-wrap { position: static; }
  .notif-panel { left: 8px; right: 8px; width: auto; top: calc(100% + 6px); max-height: calc(100dvh - 90px); display: flex; flex-direction: column; }
  .notif-panel > :not(.notif-head) { overflow-y: auto; }
}
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: min(440px, 70vh); overflow-y: auto; }
.notif { display: flex; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--accent-soft); }
.notif-text { display: block; font-size: 13px; line-height: 1.4; }
.notif.unread .notif-text { font-weight: 500; }
.notif-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; flex-shrink: 0; color: var(--muted); }
.notif.unread .notif-ic { color: var(--accent-text); background: var(--surface); }

/* ---------- Favoritos ---------- */
.btn-fav.on { color: #d4a106; border-color: color-mix(in srgb, #d4a106 40%, var(--border)); }
.btn-fav.on:hover { background: color-mix(in srgb, #d4a106 10%, transparent); }

/* ---------- Productos ---------- */
.grid-products { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.product-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.p-cover { aspect-ratio: 4 / 3; margin: -12px -12px 4px; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.p-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-price { font-weight: 600; font-size: 15px; margin-top: auto; }
.p-price-lg { font-size: 22px; letter-spacing: -.01em; }
.modal-sm { max-width: 460px; }
.inquiry { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.inquiry textarea { resize: none; }
.inquiry-sent { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 10px; background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); font-size: 13px; }
.inquiry-sent span { color: var(--text); }
.product-page { max-width: 760px; }
.msg-product { display: flex; align-items: center; gap: 10px; padding: 6px; margin: -2px -6px 6px; border-radius: 10px; background: rgba(0, 0, 0, .06); color: inherit; min-width: 200px; font-size: 13px; }
.msg.mine .msg-product { background: rgba(255, 255, 255, .16); }
.msg-product img, .msg-product .mp-ic { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.thumb-sm { width: 44px; height: 44px; color: var(--muted); }
.ptable td { vertical-align: middle; }
.input-sm { height: 32px; padding: 0 8px; font-size: 13px; width: 110px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper .input-sm { width: 70px; text-align: center; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: var(--text); }
.link-btn:hover { color: var(--accent-text); }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Escáner */
#scanner-root .modal-backdrop { z-index: 70; }
.scan-box { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
#scan-region, #scan-region video { width: 100% !important; height: 100%; object-fit: cover; display: block; }
#scan-region { position: absolute; inset: 0; }
.scan-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #ef4444; box-shadow: 0 0 8px #ef4444; pointer-events: none; }
.scan-off { height: 100%; display: grid; place-items: center; align-content: center; gap: 8px; color: #bbb; font-size: 13px; }

/* ---------- Reservas ---------- */
.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.space { display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer; padding: 14px; }
.space.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grid-res { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.slots { display: grid; gap: 6px; margin-top: 10px; }
.slot { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; text-align: left; width: 100%; }
.slot-h { font-variant-numeric: tabular-nums; font-weight: 500; width: 46px; }
.slot.free { cursor: pointer; }
.slot.free:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.slot.free:disabled { color: var(--muted); cursor: not-allowed; background: var(--surface-2); }
.slot.taken { background: var(--surface-2); }
.slot.mine { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.slot.pending { border-style: dashed; }
/* Incidencias: edición rápida en la lista */
.inc-row + .inc-row { border-top: 1px solid var(--border); }
.inc-row .list-item { border-top: 0 !important; border-bottom: 0; align-items: center; }
.inc-row .list-item > .row { align-self: center; }
.inc-line { display: flex; align-items: center; gap: 10px; }
.inc-quick-btn { flex-shrink: 0; }
.inc-quick { margin: 0 0 14px 44px; padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.inc-quick-fields { display: flex; gap: 12px; align-items: flex-start; }
.inc-quick-fields .field.grow { flex: 1 1 auto; min-width: 0; }
.inc-quick-fields .field:first-child:not(.grow) { width: 180px; flex-shrink: 0; }
.inc-quick .field { margin-bottom: 0; }
.inc-quick .form-foot { margin-top: 10px; }
@media (max-width: 600px) {
  .inc-line { flex-wrap: wrap; gap: 0; }
  .inc-line > .list-item { flex: 1 1 100%; flex-wrap: wrap; row-gap: 6px; padding-bottom: 6px; }
  .inc-line > .list-item > .grow { flex: 1 1 calc(100% - 50px); }
  .inc-line > .list-item > .row { width: 100%; padding-left: 44px; }
  .inc-quick-btn { margin: 0 0 10px 44px; }
  .inc-quick { margin-left: 0; }
  .inc-quick-fields { flex-direction: column; gap: 10px; align-items: stretch; }
  .inc-quick-fields .field:first-child:not(.grow) { width: 100%; }
}
@media (max-width: 600px) {
  .res-pend { flex-wrap: wrap; }
  .res-pend .res-btns { width: 100%; justify-content: flex-start !important; padding-left: 44px; }
}
.slot .btn { flex-shrink: 0; }

/* ---------- Incidencias ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--warn); flex-shrink: 0; margin-top: 5px; }
.tl-dot.en_proceso { background: var(--accent); }
.tl-dot.resuelta { background: var(--ok); }

/* ---------- Documentos ---------- */
.doc-ic { width: 40px; height: 46px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 10px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; letter-spacing: .03em; }

@media (max-width: 900px) {
  .grid-res { grid-template-columns: 1fr; }
  .grid-products { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .topbar .search { min-width: 0; flex: 1; }
}

@media (max-width: 600px) {
  .profile-head .grow { flex-basis: 100%; order: 3; }
  .profile-head > div:last-child:not(.grow) { margin-left: auto; }
  .grid-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card { padding: 10px; }
  .p-cover { margin: -10px -10px 4px; }
}

/* ---------- Marca con logo, selector de centro e ingreso ---------- */
/* Logo sin fondo: se muestra solo la cuadrícula (la parte superior de la imagen); el texto
   "WORK CENTER" de la imagen es blanco y no se vería sobre fondo claro, y el nombre ya va al lado. */
/* Logotipo del cliente: completo (sin recortes) sobre su color de marca; respeta la transparencia del PNG */
.brand-logo { background: var(--accent); padding: 4px; overflow: hidden; border-radius: 10px; width: 46px !important; height: 46px !important; margin-top: -6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .22), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.shell.rail .brand-logo { width: 40px !important; height: 40px !important; margin-top: -3px; padding: 3px; }
.brand-logo { display: flex !important; align-items: center; justify-content: center; box-sizing: border-box; }
.brand-logo img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; filter: var(--logo-shadow); }
/* ---- Animación de escala muy sutil en todos los botones ----
   Crece un 3% al pasar el mouse y se achica levemente al presionar. */
.btn, .chip, .tab, .slot.free, .card.space, .pick-item, .rail-menu-btn, .bell, .theme-btn {
  transition: transform .18s ease, background .15s, filter .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:not(:disabled):hover, .chip:hover, .tab:hover, .slot.free:not(:disabled):hover, .card.space:hover, .pick-item:hover { transform: scale(1.03); }
.btn:not(:disabled):active, .chip:active, .tab:active, .slot.free:not(:disabled):active, .card.space:active, .pick-item:active { transform: scale(.97); }
/* En listas anchas la escala se nota menos; los botones de ícono crecen un poco más */
.btn-icon:not(:disabled):hover { transform: scale(1.08); }
.btn-icon:not(:disabled):active { transform: scale(.92); }
.slot.free:not(:disabled):hover, .card.space:hover { transform: scale(1.01); }
@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .tab, .slot.free, .card.space, .pick-item { transition: background .15s, color .15s; }
  .btn:hover, .btn:active, .chip:hover, .chip:active, .tab:hover, .tab:active, .slot.free:hover, .card.space:hover, .pick-item:hover { transform: none !important; }
}

/* ---- Escala sutil en todo lo que se puede presionar: tarjetas (indicadores del inicio, productos,
   servicios, empresas, espacios) y filas de listas que abren algo ---- */
a.card, .card.clickable, .card[data-action], a.list-item, .list-item[data-action], .notif-item, .fav-card {
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), border-color .15s, box-shadow .2s, background .15s;
}
a.card:hover, .card.clickable:hover, .card[data-action]:hover { transform: scale(1.02); }
a.card:active, .card.clickable:active, .card[data-action]:active { transform: scale(.985); }
/* Las filas de listas son anchas: se desplazan apenas en vez de crecer */
a.list-item:hover, .list-item[data-action]:hover { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) {
  a.card, .card.clickable, .card[data-action], a.list-item, .list-item[data-action] { transition: border-color .15s, box-shadow .2s; }
  a.card:hover, .card.clickable:hover, .card[data-action]:hover, a.list-item:hover, .list-item[data-action]:hover { transform: none !important; }
}

/* ---- Botones del menú: al pasar el mouse se desplazan suavemente a la derecha y el ícono se adelanta ---- */
.nav a { transition: transform .25s cubic-bezier(.22, 1, .36, 1), background .2s ease, color .2s ease; }
.nav a > svg { transition: transform .25s cubic-bezier(.22, 1, .36, 1); }
.nav a:hover { transform: translateX(4px); }
.nav a:hover > svg { transform: translateX(2px) scale(1.1); }
.nav a:active { transform: translateX(2px) scale(.98); }
/* En la franja de íconos (menú cerrado) no hay espacio lateral: el ícono sube levemente */
.shell.rail .nav a:hover { transform: translateY(-2px); }
.shell.rail .nav a:hover > svg { transform: scale(1.12); }
@media (prefers-reduced-motion: reduce) { .nav a, .nav a > svg { transition: background .2s, color .2s; } .nav a:hover, .nav a:hover > svg { transform: none !important; } }

/* El logo y el nombre llevan al Inicio; al pasar el mouse el logo se anima suavemente */
a.brand { color: inherit; text-decoration: none; cursor: pointer; }
a.brand .brand-mark { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), filter .35s ease; }
a.brand:hover .brand-mark, a.brand:focus-visible .brand-mark { transform: scale(1.08) rotate(-4deg); filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .18)); }
a.brand .brand-name { transition: color .25s ease; }
a.brand:hover .brand-name { color: var(--accent-text); }
a.brand:active .brand-mark { transform: scale(.96); }
a.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { a.brand .brand-mark { transition: none; } a.brand:hover .brand-mark { transform: none; } }
.login-card .brand-mark.brand-logo { width: 46px; height: 46px; }
.centro-select { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 6px 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--accent-text); flex-shrink: 0; cursor: pointer; }
.centro-select select { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 500; height: 100%; padding-right: 4px; cursor: pointer; max-width: 190px; }
.centro-select select:focus { outline: none; }
.centro-select:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Opciones de las listas desplegables: mismo fondo y texto que el tema (claro u oscuro) para que siempre se lean */
select option, .centro-select option { background: var(--surface); color: var(--text); }
select option:checked { background: var(--surface-2); color: var(--text); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 42px; }
.pw-eye { position: absolute; right: 2px; top: 2px; height: 34px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px; min-height: 0; margin: 0 0 10px; }
.form-error:empty { display: none; }
.form-error.ok { color: var(--ok); }
.demo-box { border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; }
.demo-box summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); }
.demo-box .pick-item { border: 0; border-radius: 8px; margin-top: 4px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- Alertas de stock e historial ---------- */
.alert-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); color: var(--text); }
.alert-box > svg { color: var(--danger); flex-shrink: 0; margin-top: 2px; }
.alert-box.info-box { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); }
.alert-box.info-box > svg { color: var(--accent-text); }
.chip-alert { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); color: var(--danger); background: var(--surface); }
.stat-alert .value { color: var(--danger); }
.input-xs { width: 70px; }
.move { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.move.in { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.move.out { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg input:focus-visible + span { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); }

@media (max-width: 900px) {
  .centro-select select { max-width: 110px; font-size: 13px; }
  .topbar { gap: 8px; }
}
@media (max-width: 520px) {
  .topbar .search { display: none; }
  .centro-select { flex: 1; }
  .centro-select select { max-width: none; width: 100%; }
}

/* ---------- Contacto con administración y mapas ---------- */
.side-contact { width: 100%; justify-content: flex-start; margin: 12px 0 10px; color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.map-box { height: 260px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; z-index: 0; position: relative; }
.map-lg { height: min(560px, 70vh); border: 0; border-radius: 0; }
.map-off { height: 100%; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); font-size: 13px; text-align: center; padding: 12px; }
.map-pin { display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--warn); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.map-pin.en_proceso { background: var(--accent); }
.map-pin.resuelta { background: var(--ok); }
.map-pin.pin-new { background: var(--danger); }
.map-home { height: 340px; border: 0; border-radius: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.map-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); display: inline-block; }
.map-dot.en_proceso { background: var(--accent); }
@media (max-width: 600px) { .map-home { height: 260px; } }

/* Indicadores del inicio: una sola fila en computador y tablet; 2 filas de 2 en celular */
.grid-4.stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat .l-short { display: none; }
@media (max-width: 1000px) {
  .stats-row { gap: 10px; }
  .stats-row .stat { padding: 12px 14px; }
  .stats-row .stat .value { font-size: 24px; }
}
@media (max-width: 600px) {
  .grid-4.stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---------- Botón del menú en la barra izquierda (bajo el logo, sobre Inicio); lupa en celular ---------- */
.topbar .btn.menu-btn { display: none !important; }
.btn.rail-menu-btn { display: inline-flex; flex-shrink: 0; align-self: flex-start; margin: 0 0 8px 4px; color: var(--muted); }
.btn.rail-menu-btn:hover { color: var(--text); }
.shell.rail .btn.rail-menu-btn { align-self: center; margin-left: 0; }
.btn.search-btn { display: none; }
@media (max-width: 900px) {
  .btn.search-btn { display: inline-flex; flex-shrink: 0; }
  .topbar .search { display: none; }
  /* Buscador desplegado: fila completa bajo la barra superior */
  .topbar.search-open .search { display: block; position: absolute; left: 0; right: 0; top: 100%; max-width: none; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
  .topbar.search-open .search svg { left: 23px; }
  .topbar.search-open .btn.search-btn { background: var(--accent-soft); color: var(--accent-text); }
}

/* ---------- Pantallas de poca altura (notebooks, zoom del navegador) ---------- */
/* El menú se compacta para que todas las opciones quepan sin desplazarse */
@media (min-width: 901px) and (max-height: 800px) {
  .sidebar { padding-top: 12px; padding-bottom: 10px; }
  .brand { padding-bottom: 10px; }
  .nav { gap: 0; }
  .nav a { padding-top: 6px; padding-bottom: 6px; }
  .nav-label { padding: 10px 10px 4px; }
  .side-contact { margin: 8px 0 6px; }
  .side-foot { padding-top: 8px; }
}

/* ---------- Pantallas grandes: Full HD+, 2K, 4K y ultrapanorámicas ---------- */
/* El contenido se centra y crece con la pantalla; en 2K+ también suben letra, botones y espaciados. */
@media (min-width: 1600px) {
  .content { max-width: 1440px; margin-inline: auto; padding-left: 40px; padding-right: 40px; }
  .content-mensajes { max-width: 1600px; }
  .topbar { padding: 0 40px; }
}
@media (min-width: 2200px) {
  body { font-size: 15.5px; }
  h1 { font-size: 27px; }
  h2, h3 { font-size: 17px; }
  .meta { font-size: 14px; }
  .sub, .li-title, .input, .centro-select select { font-size: 15.5px; }
  .shell { grid-template-columns: 284px 1fr; }
  .sidebar { padding: 20px 14px; }
  .nav a { font-size: 15.5px; padding: 10px 12px; }
  .brand-name { font-size: 16px; }
  :root { --topbar-h: 68px; }
  .topbar { height: var(--topbar-h); padding: 0 48px; }
  .topbar .search { max-width: 560px; }
  .content { max-width: 1840px; padding: 36px 48px 56px; }
  .content-mensajes { max-width: 2000px; padding-bottom: 28px; }
  .chat { height: calc(100dvh - 68px - 64px); grid-template-columns: 380px 1fr; }
  .btn { height: 40px; font-size: 15px; padding: 0 16px; }
  .btn-sm { height: 34px; font-size: 14px; }
  .btn-icon { width: 38px; padding: 0; }
  .input { height: 42px; }
  .card { padding: 22px; }
  .grid { gap: 18px; }
  .home-grid { gap: 20px; }
  .stat .label { font-size: 14px; }
  .stat .value { font-size: 34px; }
  .chip, .tab, .badge { font-size: 14px; }
  .map-home { height: 460px; }
  .map-lg { height: min(780px, 72vh); }
  .grid-products { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
  .space-grid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
}
/* Ultrapanorámicas y 4K: más ancho útil, sin estirar líneas de texto en exceso */
@media (min-width: 3000px) {
  .content { max-width: 2240px; }
  .content-mensajes { max-width: 2400px; }
  .map-home { height: 520px; }
}
.leaflet-container { font: inherit; }
.leaflet-popup-content a { color: var(--accent); }

/* ---------- Correcciones de ancho en celular ---------- */
/* Los botones del encabezado bajan de línea en vez de empujar la página hacia la derecha */
.page-head > div { min-width: 0; }
.page-head .row { flex-wrap: wrap; }
/* Las columnas de las grillas nunca se ensanchan más que la pantalla */
.grid > * { min-width: 0; }
@media (max-width: 600px) {
  .page-head { align-items: stretch; }
  .page-head > .row, .page-head > .btn, .page-head > a.btn { width: 100%; }
  .page-head .row .btn, .page-head > .btn, .page-head > a.btn { flex: 1 1 auto; justify-content: center; white-space: normal; height: auto; min-height: 38px; padding-top: 7px; padding-bottom: 7px; text-align: center; line-height: 1.25; }
  .row.wrap .btn, .form-foot .btn { white-space: normal; height: auto; min-height: 34px; text-align: center; }
  .form-foot { flex-wrap: wrap; }
}
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.space-grid { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.contact-row > * { min-width: 0; overflow-wrap: anywhere; }
.profile-head > .grow { min-width: 0; }
.profile-head > .row { flex-wrap: wrap; min-width: 0; }
.slot { min-width: 0; }
.slot .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-head.wrap { flex-wrap: wrap; }
.section-head .input[type=date] { max-width: 100%; }
@media (max-width: 600px) { .profile-head > .row .btn { flex: 1 1 auto; justify-content: center; white-space: normal; height: auto; min-height: 36px; } }
