/* Parquea — tokens y componentes. Mobile-first. Tema por [data-theme="light|dark"] en <html>. */
@font-face { font-family: "Manrope"; src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --brand-petrol: #123D38; --brand-emerald: #087F66; --brand-mint: #C8F5DF;
  --warning: #F5B544;

  --bg: #F5F7F2; --card: #FFFFFF; --card-2: #EEF2EC;
  --text: #142622; --text-soft: #4A5E59;       /* 7.4:1 sobre --bg */
  --line: #D9E1DB;
  --primary: #087F66; --primary-text: #FFFFFF; /* 5.0:1 */
  --primary-soft: #E3F5EC; --on-primary-soft: #0B5F4D;
  --sidebar: #123D38; --sidebar-text: #E6F2EC; --sidebar-soft: #1B4F48;
  --danger: #B42318; --danger-soft: #FDECEA;
  --ok: #087F66; --warn-text: #6B4600; --warn-soft: #FFF4DC;
  --focus: #087F66;
  --shadow: 0 1px 2px rgba(18,61,56,.06), 0 4px 16px rgba(18,61,56,.06);

  --r: 10px; --r-lg: 16px;
  --t: 180ms;
  --font-head: "Manrope", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101B1A; --card: #192825; --card-2: #14211F;
  --text: #F2F7F4; --text-soft: #A9BDB6;       /* 9.6:1 sobre --bg */
  --line: #28403B;
  --primary: #C8F5DF; --primary-text: #0C2A26;  /* 11:1 */
  --primary-soft: #1D3A34; --on-primary-soft: #C8F5DF;
  --sidebar: #0C1514; --sidebar-text: #DCEAE4; --sidebar-soft: #17302B;
  --danger: #FF8A7A; --danger-soft: #3A1F1C;    /* variante nocturna por contraste */
  --ok: #6EE7B7; --warn-text: #F5B544; --warn-soft: #33290F;
  --focus: #C8F5DF;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; line-height: 1.2; letter-spacing: -.01em; }
a { color: var(--primary); }
.num { font-variant-numeric: tabular-nums; }

/* Accesibilidad */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 999; background: var(--primary); color: var(--primary-text); padding: 10px 14px; border-radius: var(--r); }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }

/* Botones (alto táctil ≥ 44px, radio 10px) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r); border: 1px solid transparent; font: 600 15px/1 var(--font-body); cursor: pointer; text-decoration: none; transition: background var(--t), border-color var(--t), transform var(--t); }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--card-2); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #2a0d09; }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--card-2); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid var(--primary-text); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Campos */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--text); font: 16px var(--font-body); transition: border-color var(--t), box-shadow var(--t); }
.input::placeholder { color: var(--text-soft); opacity: .8; }
.input:hover { border-color: var(--text-soft); }
.input:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.hint { font-size: 14px; color: var(--text-soft); margin-top: 4px; }

/* Tarjetas, KPI */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; }
.card-title { font: 700 16px var(--font-head); margin-bottom: 12px; }
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--on-primary-soft); flex: none; }
.kpi-val { font: 800 26px var(--font-head); line-height: 1; }
.kpi-lbl { font-size: 14px; color: var(--text-soft); margin-top: 4px; }
.gx { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { min-width: 0; } .kpi > div { min-width: 0; } .kpi-val { overflow-wrap: anywhere; }
@media (max-width: 479px) { .kpi { flex-direction: column; align-items: flex-start; gap: 8px; } .card { padding: 16px; } }
@media (min-width: 1024px) { .grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Estado: siempre ícono + texto, nunca solo color */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--card-2); color: var(--text-soft); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--primary-soft); color: var(--on-primary-soft); }
.badge-warn { background: var(--warn-soft); color: var(--warn-text); }
.badge-warn::before { border-radius: 2px; transform: rotate(45deg); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-danger::before { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* Alertas */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); font-size: 15px; border: 1px solid var(--line); background: var(--card-2); }
.alert-ok { background: var(--primary-soft); color: var(--on-primary-soft); border-color: transparent; }
.alert-warn { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* Tablas -> tarjetas en móvil */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; color: var(--text-soft); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); }
@media (max-width: 639px) {
  .table.stack thead { display: none; }
  .table.stack tr { display: block; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; margin-bottom: 10px; background: var(--card); }
  .table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 0; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--text-soft); font-size: 13px; text-align: left; }
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: flex-end; justify-content: center; background: rgba(8,20,18,.6); padding: 0; }
.modal.open { display: flex; }
.modal-box { background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); border: 1px solid var(--line); }
@media (min-width: 640px) { .modal { align-items: center; padding: 20px; } .modal-box { border-radius: var(--r-lg); } }

/* Loader: símbolo estable + tres puntos */
.loader { display: grid; justify-items: center; gap: 10px; padding: 32px; color: var(--text-soft); }
.loader img { width: 36px; height: auto; }
.dots { display: flex; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.empty { text-align: center; padding: 32px 16px; color: var(--text-soft); }

/* Toast */
#toasts { position: fixed; z-index: 300; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); display: grid; gap: 8px; pointer-events: none; }
@media (min-width: 1024px) { #toasts { left: auto; right: 20px; bottom: 20px; width: 360px; } }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: var(--r); background: var(--sidebar); color: #fff; box-shadow: var(--shadow); font-size: 15px; }
.toast.err { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .toast { background: var(--card); color: var(--text); border: 1px solid var(--line); }
:root[data-theme="dark"] .toast.err { background: var(--danger-soft); color: var(--danger); }

/* Barra de preferencias (idioma | moneda | tema) */
.prefs { display: inline-flex; align-items: center; gap: 4px; }
.pref-btn { min-height: 40px; min-width: 40px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: inherit; border-radius: var(--r); font: 500 14px var(--font-body); cursor: pointer; }
.pref-btn:hover { background: var(--card-2); }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); }
.seg button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-soft); font: 600 14px var(--font-body); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--sidebar); color: #fff; }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 120; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; display: none; }
.menu-pop.open { display: block; }
.menu-pop button, .menu-pop a { display: flex; width: 100%; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--text); border-radius: 8px; font: 15px var(--font-body); text-align: left; cursor: pointer; text-decoration: none; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--card-2); }
.menu-pop [aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--primary); font-weight: 700; }

/* Layout operador */
.app { min-height: 100vh; min-height: 100dvh; display: flex; }
.sidebar { display: none; width: 264px; flex: none; background: var(--sidebar); color: var(--sidebar-text); padding: 20px 14px; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
@media (min-width: 1024px) { .sidebar { display: flex; } }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: inherit; text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand b { font: 800 22px var(--font-head); letter-spacing: -.02em; }
.nav-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; opacity: .65; padding: 14px 12px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--r); color: var(--sidebar-text); text-decoration: none; font-size: 15px; font-weight: 500; transition: background var(--t); background: none; border: 0; width: 100%; cursor: pointer; font-family: inherit; text-align: left; }
.nav-link:hover { background: var(--sidebar-soft); }
.nav-link[aria-current="page"] { background: var(--brand-emerald); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .nav-link[aria-current="page"] { background: var(--primary); color: var(--primary-text); }
.nav-link svg, .tab svg { width: 20px; height: 20px; flex: none; }
.side-foot { margin-top: auto; padding-top: 14px; display: grid; gap: 8px; }
.tenant-chip { background: var(--sidebar-soft); border-radius: var(--r); padding: 10px 12px; font-size: 13px; }
.tenant-chip b { display: block; font-size: 14px; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 90; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar .brand { padding: 0; color: var(--text); }
.topbar .brand img { height: 30px; }
.topbar .brand b { font-size: 19px; }
@media (min-width: 1024px) { .topbar .brand { display: none; } }
.spacer { flex: 1; }
.page { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1280px; width: 100%; margin: 0 auto; }
@media (min-width: 1024px) { .page { padding: 28px 32px 40px; } }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 26px; }
@media (min-width: 1024px) { .page-head h1 { font-size: 30px; } }
.page-head p { margin: 6px 0 0; color: var(--text-soft); }
.tabbar { position: fixed; z-index: 95; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 1024px) { .tabbar { display: none; } }
.tab { flex: 1; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--text-soft); text-decoration: none; background: none; border: 0; cursor: pointer; font-family: inherit; }
.tab[aria-current="page"] { color: var(--primary); }
.drawer { position: fixed; inset: 0; z-index: 150; display: none; }
.drawer.open { display: block; }
.drawer-bg { position: absolute; inset: 0; background: rgba(8,20,18,.6); }
.drawer-panel { position: absolute; left: 0; top: 0; bottom: 0; width: min(86vw, 320px); background: var(--sidebar); color: var(--sidebar-text); padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.footer-note { text-align: center; color: var(--text-soft); font-size: 13px; padding: 16px; }

/* Chat */
#chat-fab { position: fixed; z-index: 96; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--primary); color: var(--primary-text); box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; }
@media (min-width: 1024px) { #chat-fab { bottom: 20px; right: 20px; } }
#chat-window { position: fixed; z-index: 160; right: 12px; left: 12px; bottom: calc(136px + env(safe-area-inset-bottom)); height: min(60vh, 440px); display: none; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
#chat-window.open { display: flex; }
@media (min-width: 640px) { #chat-window { left: auto; width: 380px; right: 20px; bottom: 84px; } }
.chat-head { padding: 12px 16px; background: var(--sidebar); color: #fff; display: flex; align-items: center; justify-content: space-between; }
#chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: grid; gap: 8px; align-content: start; font-size: 14px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; background: var(--card-2); }
.msg.mine { justify-self: end; background: var(--primary); color: var(--primary-text); }
.msg small { display: block; opacity: .75; font-size: 12px; margin-bottom: 2px; }
#chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }

/* Banner de instalación y sin conexión */
#install-bar { position: fixed; z-index: 140; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); display: none; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
#install-bar.open { display: flex; }
@media (min-width: 1024px) { #install-bar { left: auto; right: 20px; bottom: 20px; width: 440px; } }
#offline-bar { display: none; background: var(--warn-soft); color: var(--warn-text); text-align: center; padding: 8px 12px; font-size: 14px; font-weight: 600; }
#offline-bar.show { display: block; }

/* Utilidades */
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack-3 > * + * { margin-top: 12px; } .stack-4 > * + * { margin-top: 16px; } .stack-6 > * + * { margin-top: 24px; }
.muted { color: var(--text-soft); } .small { font-size: 14px; } .right { text-align: right; } .center { text-align: center; }
.plate { font: 800 28px var(--font-head); letter-spacing: .06em; text-align: center; padding: 14px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r); }
.cols-2 { grid-template-columns: 1fr; }
@media (min-width: 900px) { .cols-2 { grid-template-columns: 1fr 1fr; } .cols-3 { grid-template-columns: repeat(3, 1fr); } }
.hidden { display: none !important; }

/* Barra superior compacta en móvil: el idioma muestra solo el globo; el tema, un control de 3 íconos pequeños */
@media (max-width: 599px) {
  .prefs .pref-btn span:not(.keep) { }
  .prefs .menu-wrap:first-child .pref-btn span { display: none; }
  .pref-btn { padding: 0 8px; }
  .seg button { padding: 0 8px; min-width: 36px; justify-content: center; }
  .topbar { gap: 4px; padding: 8px 10px; }
  .topbar .brand b { font-size: 17px; }
  .menu-pop { right: -8px; }
}
@media (max-width: 439px) { .topbar .brand b { display: none; } }
@media (max-width: 479px) { .login-lbl { display: none; } }


/* Estado del pin del mapa: color + símbolo (nunca solo color) */
.pin { position: relative; }
.pin i.st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 800 12px var(--font-head); font-style: normal; color: #fff; }
.pin.s-ok { border-color: #087F66; } .pin.s-ok i.st { background: #087F66; }
.pin.s-few { border-color: #B7791F; } .pin.s-few i.st { background: #E0A100; color: #2B1B00; }
.pin.s-full { border-color: #B42318; } .pin.s-full i.st { background: #B42318; }
.pin.s-unknown i.st { background: #6B7C77; }
.pin.sel { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 55%, transparent), var(--shadow); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin-right: 6px; }
.dot.ok { background: #087F66; } .dot.few { background: #E0A100; } .dot.full { background: #B42318; } .dot.unknown { background: #6B7C77; }
.badge-full { background: var(--danger-soft); color: var(--danger); }
.legend { position: absolute; z-index: 400; left: 10px; bottom: 28px; max-width: min(280px, calc(100% - 20px)); }
@media (max-width: 899px) { .legend { display: none; } }
@media (min-width: 900px) { #btn-legend { display: none; } }
.legend summary { list-style: none; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 999px; font: 600 14px var(--font-body); box-shadow: var(--shadow); }
.legend[open] summary { border-radius: var(--r); }
.legend .legend-body { margin-top: 6px; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; font-size: 14px; box-shadow: var(--shadow); }
.legend .legend-body div { margin: 4px 0; }

/* Chat tipo WhatsApp */
.wa { position: fixed; z-index: 250; display: none; flex-direction: column; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; inset: 0; border-radius: 0; }
.wa.open { display: flex; }
@media (min-width: 640px) { .wa { inset: auto 20px 20px auto; width: 380px; height: min(620px, 86vh); border-radius: var(--r-lg); } }
.wa-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #0B4D43; color: #fff; }
:root[data-theme="dark"] .wa-head { background: #0F2F2A; }
.wa-head b { display: block; font-size: 16px; line-height: 1.2; } .wa-head small { opacity: .85; display: block; }
.wa-av { width: 38px; height: 38px; border-radius: 50%; background: #C8F5DF; color: #123D38; display: grid; place-items: center; font: 800 16px var(--font-head); flex: none; }
.wa-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: #E8EFE6; }
:root[data-theme="dark"] .wa-body { background: #0E1A18; }
.wa-note { align-self: center; max-width: 92%; text-align: center; font-size: 12.5px; background: #FFF4DC; color: #5A3E00; border-radius: 8px; padding: 6px 10px; }
:root[data-theme="dark"] .wa-note { background: #33290F; color: #F5B544; }
.wa-day { align-self: center; font-size: 12px; background: rgba(0,0,0,.08); color: var(--text); border-radius: 8px; padding: 2px 10px; margin: 6px 0; }
:root[data-theme="dark"] .wa-day { background: rgba(255,255,255,.1); }
.wa-msg { max-width: 82%; padding: 6px 9px 4px; border-radius: 10px; font-size: 15px; line-height: 1.35; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.wa-msg.in { align-self: flex-start; background: #fff; color: #142622; border-top-left-radius: 2px; }
.wa-msg.out { align-self: flex-end; background: #D8F8C8; color: #142622; border-top-right-radius: 2px; }
:root[data-theme="dark"] .wa-msg.in { background: #1E2F2B; color: #F2F7F4; }
:root[data-theme="dark"] .wa-msg.out { background: #0B5B4B; color: #F2F7F4; }
.wa-meta { display: flex; justify-content: flex-end; align-items: center; gap: 3px; font-size: 11px; opacity: .75; margin-top: 2px; font-variant-numeric: tabular-nums; }
.wa-who { font-size: 12px; font-weight: 700; color: #087F66; margin-bottom: 1px; }
:root[data-theme="dark"] .wa-who { color: #6EE7B7; }
.tick { display: inline-flex; width: 18px; height: 12px; color: #7A8A86; }
.tick.read { color: #2F8BE6; }
.tick svg { width: 18px; height: 12px; }
.wa-form { display: flex; gap: 8px; padding: 8px; background: var(--card-2); border-top: 1px solid var(--line); padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.wa-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 110px; border: 1px solid var(--line); border-radius: 22px; padding: 11px 14px; font: 16px var(--font-body); background: var(--card); color: var(--text); }
.wa-form button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #087F66; color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
:root[data-theme="dark"] .wa-form button { background: #C8F5DF; color: #0C2A26; }
.wa-start { padding: 16px; display: grid; gap: 12px; }

/* El punto del badge de cupos toma el color exacto del pin */
.badge.st-ok::before { background: #087F66; } .badge.st-few::before { background: #E0A100; } .badge.st-full::before { background: #B42318; }

/* Avatares y Respuestas rápidas en chat */
.wa-msg-header { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.wa-msg-av { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid rgba(0,0,0,.08); vertical-align: middle; }
.wa-quick-bar { display: flex; gap: 6px; padding: 6px 10px; background: var(--card-2); border-top: 1px solid var(--line); overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
.wa-quick-chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: all .15s; flex: none; }
.wa-quick-chip:hover { background: #087F66; color: #fff; border-color: #087F66; }
.wa-quick-chip.wa-quick-cfg { padding: 4px 8px; }
.wa-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); z-index: 260; display: flex; align-items: center; justify-content: center; padding: 12px; }
.wa-modal-content { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); width: 100%; max-width: 340px; max-height: 90%; overflow-y: auto; padding: 16px; box-shadow: var(--shadow-lg); color: var(--text); }

/* Panel flotante de chats para el personal desde la burbuja */
.staff-chat-popup { position: fixed; bottom: 80px; right: 20px; width: min(360px, calc(100vw - 40px)); max-height: min(520px, 75vh); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 210; display: flex; flex-direction: column; overflow: hidden; animation: popIn .2s ease-out; }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.staff-chat-popup.hidden { display: none; }
.staff-chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: #0B4D43; color: #fff; }
:root[data-theme="dark"] .staff-chat-head { background: #0F2F2A; }
.staff-chat-list { flex: 1; overflow-y: auto; padding: 4px 0; max-height: 380px; }
.staff-chat-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; background: none; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); transition: background .15s; color: var(--text); }
.staff-chat-item:hover { background: var(--card-2); }
.staff-chat-item.has-unread { background: color-mix(in srgb, #087F66 8%, var(--card)); }
.staff-chat-item-av { width: 36px; height: 36px; border-radius: 50%; background: #C8F5DF; color: #123D38; display: grid; place-items: center; font: 700 14px var(--font-head); flex: none; overflow: hidden; }
.staff-chat-item-av img { width: 100%; height: 100%; object-fit: cover; }
.staff-chat-foot { display: flex; align-items: center; padding: 8px 12px; background: var(--card-2); border-top: 1px solid var(--line); font-size: 12px; }


/* ---------- Placa colombiana (amarilla, letras negras): mismo aspecto en tema claro y oscuro ---------- */
.cplate { --pl-ink: #111A16; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  background: #F6C318; color: var(--pl-ink); border: 2px solid var(--pl-ink); border-radius: 7px;
  box-shadow: inset 0 0 0 2px #F6C318, inset 0 0 0 3px rgba(17,26,22,.55); font-family: var(--font-head); line-height: 1; }
.cplate-num { font-weight: 800; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.cplate-city { font-weight: 700; letter-spacing: .28em; font-size: .62em; margin-top: .35em; opacity: .8; }
.cplate-lg { display: flex; width: 100%; max-width: 360px; margin: 0 auto; padding: 16px 14px 10px; border-width: 3px; border-radius: 10px; }
.cplate-lg .cplate-num { font-size: clamp(34px, 9cqi, 52px); }
.cplate-lg .cplate-city { font-size: 11px; }
.cplate-num { white-space: nowrap; }
.cplate-sm { padding: 5px 6px 4px; width: 124px; }
.cplate-sm .cplate-num { font-size: 18px; letter-spacing: .06em; }
.cplate-sm.is-long .cplate-num { font-size: 15px; letter-spacing: .03em; }
.cplate-lg.is-long .cplate-num { font-size: clamp(28px, 7.5cqi, 44px); letter-spacing: .05em; }
.cplate-sm .cplate-city { font-size: 7px; margin-top: 2px; }
