:root {
  --bg: #0b0f17; --fg: #e6ebf5; --mute: #8b96ab; --line: rgba(255,255,255,.09);
  --glass: rgba(14,19,30,.72); --glass-2: rgba(255,255,255,.05); --glass-3: rgba(255,255,255,.09);
  --accent: #7c9cff; --new: #22ff88; --danger: #ff5c6c; --warn: #fbbf24;
  --shadow: 0 10px 40px rgba(0,0,0,.45); --r: 14px; --panel-w: 400px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef2f8; --fg: #0f172a; --mute: #5b6578; --line: rgba(15,23,42,.1);
  --glass: rgba(255,255,255,.78); --glass-2: rgba(15,23,42,.05); --glass-3: rgba(15,23,42,.09);
  --accent: #3b5bdb; --new: #12b85f; --shadow: 0 10px 40px rgba(15,23,42,.18); color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; -webkit-font-smoothing: antialiased; }
#map { position: fixed; inset: 0; background: var(--bg); z-index: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
small { color: var(--mute); font-size: 12px; }
a { color: var(--accent); }
.spacer { flex: 1; }
.glass { background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--line); box-shadow: var(--shadow); }
[hidden] { display: none !important; }

/* ---- botones / controles ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--glass-2); color: var(--fg); padding: 8px 14px; border-radius: 10px; text-decoration: none; transition: .15s; white-space: nowrap; }
.btn:hover { background: var(--glass-3); }
.btn.primary { background: linear-gradient(135deg, #6d8cff, #8f6dff); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.icon { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass-2); display: grid; place-items: center; font-size: 17px; transition: .15s; padding: 0; }
.icon:hover { background: var(--glass-3); }
.icon.sm { width: 28px; height: 28px; font-size: 13px; }
.icon.avatar { border-radius: 50%; overflow: hidden; font-weight: 700; }
.icon.avatar img { width: 100%; height: 100%; object-fit: cover; }
.mini { border: 1px solid var(--line); background: var(--glass-2); border-radius: 8px; padding: 2px 8px; font-size: 12px; color: var(--mute); }
.mini:hover { color: var(--fg); background: var(--glass-3); }
.chip { border: 1px solid var(--line); background: var(--glass-2); color: var(--mute); border-radius: 99px; padding: 3px 10px; font-size: 12px; transition: .12s; }
.chip:hover { color: var(--fg); }
.chip.on { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--fg); border-color: var(--accent); }
input, select, textarea { background: var(--glass-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; outline: none; width: 100%; transition: border .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--bg); color: var(--fg); }
input[type=color] { width: 44px; height: 34px; padding: 2px; }
input[type=checkbox], input[type=radio] { width: auto; }
.badge { background: var(--new); color: #032a15; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 1px 7px; min-width: 20px; text-align: center; box-shadow: 0 0 10px color-mix(in srgb, var(--new) 70%, transparent); }

/* ---- barra superior ---- */
#topbar { position: fixed; z-index: 800; top: 12px; left: 12px; right: 12px; height: 54px; border-radius: 18px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; letter-spacing: .3px; margin-right: 4px; }
.brand svg { color: var(--fg); }
.mapsel { display: flex; align-items: center; gap: 8px; max-width: 250px; border: 1px solid var(--line); background: var(--glass-2); border-radius: 12px; padding: 4px 10px 4px 4px; }
.mapsel img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: var(--glass-3); }
.mapsel .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapsel i { font-style: normal; color: var(--mute); }
.mapsel:hover { background: var(--glass-3); }
.search { position: relative; flex: 0 1 340px; }
.search input { border-radius: 12px; height: 38px; }
.results { position: absolute; top: 46px; left: 0; right: 0; border-radius: 14px; padding: 6px; max-height: 60vh; overflow: auto; z-index: 900; }
.res { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 10px; cursor: pointer; text-align: left; border: 0; background: none; width: 100%; }
.res:hover { background: var(--glass-2); }
.res-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.res-t small, .res small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.menu { position: fixed; z-index: 2000; border-radius: 14px; padding: 6px; min-width: 230px; max-height: 70vh; overflow: auto; animation: pop .14s ease-out; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 9px; }
.menu button:hover { background: var(--glass-2); }
.menu-h { padding: 8px 10px; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .lay .sw { width: 26px; height: 18px; border-radius: 5px; border: 1px solid var(--line); }
.menu .lay.on { color: var(--new); font-weight: 600; }
.menu.maps { min-width: 300px; }
.mapitem img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; }
.mapitem span:not(.badge) { flex: 1; display: flex; flex-direction: column; }
.mapitem.on { background: var(--glass-2); }

/* ---- panel lateral ---- */
#panel { position: fixed; z-index: 700; top: 78px; left: 12px; bottom: 12px; width: var(--panel-w); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; transition: transform .25s ease; }
body.panel-hidden #panel { transform: translateX(calc(-100% - 20px)); }
#panel-toggle { position: fixed; z-index: 690; top: 78px; left: calc(var(--panel-w) + 22px); width: 34px; height: 34px; font-size: 14px; transition: left .25s ease; display: none; }
.sec { display: flex; flex-direction: column; min-height: 38px; overflow: hidden; }
.sec.collapsed { flex: 0 0 38px !important; }
.sec-h { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex: none; user-select: none; }
.sec-h b { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); }
.count { font-size: 12px; color: var(--mute); }
.sec-b { flex: 1; overflow: auto; padding: 0 8px 8px; scrollbar-width: thin; }
.split { height: 9px; flex: none; cursor: row-resize; position: relative; }
.split::after { content: ""; position: absolute; left: 30%; right: 30%; top: 4px; height: 1px; background: var(--line); transition: .15s; }
.split:hover::after, .split.drag::after { background: var(--accent); height: 2px; top: 3px; left: 20%; right: 20%; }
.filters { display: flex; gap: 6px; padding: 0 10px 8px; flex: none; }
.filters input { height: 30px; padding: 4px 10px; font-size: 13px; }
.filters select { width: 74px; height: 30px; padding: 2px 6px; font-size: 13px; }
.filters .chip { white-space: nowrap; }
.empty { text-align: center; color: var(--mute); padding: 18px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty.sm { padding: 10px; font-size: 13px; }
.empty .big { font-size: 32px; filter: grayscale(.3); }
.empty p { margin: 0; }

/* markers */
.mk { display: flex; gap: 10px; padding: 9px 8px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; transition: .12s; position: relative; }
.mk:hover, .mk:focus-visible { background: var(--glass-2); outline: none; }
.mk.sel { background: var(--glass-2); border-color: var(--line); }
.mk.off { opacity: .55; }
.mk .sw { width: 6px; border-radius: 4px; flex: none; }
.mk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mk-t { display: flex; gap: 8px; align-items: baseline; }
.mk-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-t .n { font-size: 11px; color: var(--mute); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--glass-3); color: var(--fg); }
.tag.pr { background: transparent; border: 1px dashed var(--line); color: var(--mute); }
.tag.rm { cursor: pointer; } .tag.rm:hover { background: color-mix(in srgb, var(--danger) 30%, transparent); }
.st { display: block; }
.st.err { color: var(--danger); } .st.warn { color: var(--warn); }
.mk-a { position: absolute; right: 6px; top: 6px; display: flex; gap: 2px; align-items: center; opacity: 0; transition: .12s; background: var(--glass); border-radius: 10px; padding: 2px 4px; border: 1px solid var(--line); }
.mk:hover .mk-a, .mk:focus-within .mk-a { opacity: 1; }
.mk-a button { border: 0; background: none; padding: 3px 5px; border-radius: 6px; font-size: 13px; }
.mk-a button:hover { background: var(--glass-3); }
.switch { position: relative; width: 30px; height: 18px; margin-left: 4px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--glass-3); border-radius: 99px; transition: .15s; }
.switch i::after { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + i { background: var(--new); }
.switch input:checked + i::after { transform: translateX(12px); }
body.readonly .mk-a { display: none; }

/* eventos */
.ev-row { display: flex; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; align-items: flex-start; position: relative; transition: .12s; }
.ev-row:hover, .ev-row:focus-visible { background: var(--glass-2); outline: none; }
.ev-row.unread::before { content: ""; position: absolute; left: -1px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: var(--new); box-shadow: 0 0 8px var(--new); }
.glyph { width: 32px; height: 32px; border-radius: 50%; background: color-mix(in srgb, var(--c) 22%, transparent); border: 1.5px solid var(--c); display: grid; place-items: center; font-size: 15px; flex: none; }
.ev-main { flex: 1; min-width: 0; }
.ev-t { font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ev-row:not(.unread) .ev-t { font-weight: 500; color: color-mix(in srgb, var(--fg) 85%, transparent); }
.srcs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.src-chip { font-size: 11px; padding: 1px 8px; border-radius: 6px; background: var(--glass-2); color: var(--mute); text-decoration: none; border: 1px solid var(--line); }
.src-chip:hover { color: var(--fg); border-color: var(--accent); }
.mk-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }

/* chat */
.chat-log { display: flex; flex-direction: column; gap: 6px; padding: 4px 10px 8px; }
.msg { max-width: 92%; padding: 7px 11px; border-radius: 14px; font-size: 13.5px; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, #5f7dff, #8a63ff); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--glass-3); border-bottom-left-radius: 4px; }
.msg code { background: var(--glass-3); padding: 0 4px; border-radius: 4px; }
.cite { text-decoration: none; font-weight: 700; color: var(--new); }
.typing { display: flex; gap: 4px; padding: 11px; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); animation: blink 1s infinite; } .typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
#chat-form { display: flex; gap: 6px; padding: 8px; flex: none; border-top: 1px solid var(--line); }
#chat-form input { border-radius: 99px; padding-left: 14px; }
#chat-form .btn { border-radius: 99px; padding: 0 14px; }
.chat-log .chip { margin: 2px; }

/* leyenda */
#legend { position: fixed; z-index: 600; bottom: 12px; left: calc(var(--panel-w) + 24px); right: 64px; margin: 0 auto; width: max-content; max-width: calc(100vw - var(--panel-w) - 100px); border-radius: 16px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; transition: left .25s; }
body.panel-hidden #legend { left: 12px; max-width: calc(100vw - 90px); }
.leg-cats { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.leg { display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; background: none; padding: 2px 8px 2px 4px; border-radius: 99px; font-size: 12px; color: var(--mute); }
.leg i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: color-mix(in srgb, var(--c) 25%, transparent); border: 1.5px solid var(--c); }
.leg:hover { background: var(--glass-2); color: var(--fg); }
.leg.off { opacity: .35; text-decoration: line-through; }
.leg-row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 12px; color: var(--mute); }
.new-key { display: inline-flex; align-items: center; gap: 6px; } .new-key i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--new); box-shadow: 0 0 8px var(--new); }
.age-key { display: inline-flex; align-items: center; gap: 6px; } .age-key u { display: inline-block; width: 60px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #fff, rgba(255,255,255,.15)); } .age-key em { font-style: normal; }

/* ---- eventos en el mapa ---- */
.ev-wrap, .cl-wrap { background: none; border: 0; }
.ev { position: relative; width: var(--s); height: var(--s); margin: 8px; border-radius: 50%; display: grid; place-items: center; font-size: calc(var(--s) * .5); background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 45%, #111), color-mix(in srgb, var(--c) 22%, #0a0d14)); border: 2px solid var(--c); box-shadow: 0 2px 10px rgba(0,0,0,.5); transition: opacity .6s, transform .15s; filter: saturate(calc(1 - var(--g, 0) * .8)); cursor: pointer; }
.ev:hover { transform: scale(1.18); z-index: 10; }
.ev span { line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.ev.hot::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid var(--c); opacity: .35; }
.ev.is-new { border-color: var(--new); box-shadow: 0 0 0 3px color-mix(in srgb, var(--new) 35%, transparent), 0 0 18px var(--new), 0 2px 10px rgba(0,0,0,.5); }
.ev.is-new::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--new); animation: ring 2s ease-out infinite; }
.ev.pop { animation: popin .6s cubic-bezier(.2,1.6,.4,1); }
.cl { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: radial-gradient(circle at 30% 25%, #5a6a94, #1c2438); border: 2px solid rgba(255,255,255,.5); box-shadow: 0 2px 12px rgba(0,0,0,.5); position: relative; }
.cl[data-sev="4"], .cl[data-sev="5"] { border-color: #f97316; }
.cl.is-new { border-color: var(--new); box-shadow: 0 0 16px var(--new); } .cl.is-new::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--new); animation: ring 2s ease-out infinite; }
.leaflet-marker-icon.leaflet-cluster-anim { transition: transform .3s ease-out, opacity .3s ease-in; }
.handle { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid #6d8cff; box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: ew-resize; margin: 2px; }
.handle-wrap { background: none; border: 0; }
.drawing, .drawing .leaflet-interactive { cursor: crosshair !important; }
.draw-hint { position: fixed; z-index: 3000; top: 78px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--glass); backdrop-filter: blur(16px); border: 1px solid var(--accent); border-radius: 99px; padding: 6px 8px 6px 16px; box-shadow: var(--shadow); font-size: 13px; max-width: calc(100vw - 20px); }
.area-shape { transition: stroke-width .15s; }

/* leaflet skin */
.leaflet-container { background: var(--bg); font: inherit; }
.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-bar a { background: var(--glass); color: var(--fg); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.leaflet-bar a:hover { background: var(--glass-3); color: var(--fg); }
.leaflet-control-scale-line { background: var(--glass); color: var(--fg); border-color: var(--mute); }
.leaflet-control-attribution { background: var(--glass) !important; color: var(--mute) !important; font-size: 10px; border-radius: 8px 8px 0 0; } .leaflet-control-attribution a { color: var(--mute) !important; }
.leaflet-control-scale { margin-left: calc(var(--panel-w) + 24px) !important; margin-bottom: 14px !important; }
.leaflet-bottom.leaflet-left .leaflet-control-attribution { margin-left: calc(var(--panel-w) + 24px); }
:root[data-base="sat"] .leaflet-container { background: #05080d; }
.ev-pop .leaflet-popup-content-wrapper { background: var(--glass); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px); color: var(--fg); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 0; }
.ev-pop .leaflet-popup-content { margin: 0; width: auto !important; }
.ev-pop .leaflet-popup-tip { background: var(--glass); border: 1px solid var(--line); }
.ev-pop a.leaflet-popup-close-button { color: var(--mute); top: 8px; right: 8px; }
.card { padding: 14px 16px 12px; }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; padding-right: 18px; }
.chip-cat { font-size: 12px; font-weight: 600; color: var(--c); }
.sev { font-size: 9px; letter-spacing: 1px; color: var(--c); } .sev i { font-style: normal; opacity: .22; }
.card h4 { margin: 0 0 4px; font-size: 15.5px; line-height: 1.25; }
.card .meta { font-size: 12px; color: var(--mute); margin-bottom: 8px; } .card .meta .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
.card p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.45; }
.card .srcs { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; max-height: 130px; overflow: auto; }
.src { display: flex; gap: 8px; align-items: baseline; text-decoration: none; font-size: 12px; padding: 5px 8px; background: var(--glass-2); border-radius: 8px; border: 1px solid var(--line); color: var(--fg); min-width: 0; }
.src b { color: var(--accent); flex: none; } .src span { color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src:hover { border-color: var(--accent); }
.card-a { display: flex; gap: 6px; } .card-a button { flex: 1; border: 1px solid var(--line); background: var(--glass-2); border-radius: 8px; padding: 5px 4px; font-size: 12px; } .card-a button:hover { background: var(--glass-3); }

/* ---- modales ---- */
.backdrop { position: fixed; inset: 0; z-index: 2500; background: rgba(4,6,12,.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.backdrop.out { opacity: 0; transition: .16s; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 20px; padding: 0; animation: pop .18s ease-out; background: color-mix(in srgb, var(--bg) 88%, transparent); }
.modal.wide { width: min(720px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: inherit; z-index: 2; backdrop-filter: blur(14px); }
.modal-h b { font-size: 16px; }
.form { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.form h4 { margin: 8px 0 -4px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.lead { margin: 0; color: var(--mute); font-size: 13px; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld > span { font-size: 12px; font-weight: 600; color: var(--mute); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.colorrow { display: flex; gap: 10px; align-items: center; } .pal { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.pc { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; padding: 0; } .pc.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass-2); font-size: 12px; transition: .12s; }
.tool i { font-style: normal; font-size: 20px; } .tool:hover { border-color: var(--accent); background: var(--glass-3); transform: translateY(-1px); }
.area-info { font-size: 13px; } .area-info .ok, .ok { color: var(--new); font-weight: 600; } .area-info .warn, .warn { color: var(--warn); }
.region-res { display: flex; flex-direction: column; max-height: 190px; overflow: auto; gap: 2px; }
.region-res .res { flex-direction: column; align-items: flex-start; gap: 0; }
.taginput { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass-2); min-height: 40px; align-items: center; }
.taginput input { border: 0; background: none; flex: 1; min-width: 140px; padding: 4px; }
.sugs { display: flex; flex-wrap: wrap; gap: 5px; }
.runs summary { cursor: pointer; color: var(--mute); font-size: 13px; }
.runs-b { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; font-size: 12px; } .run { display: flex; justify-content: space-between; gap: 10px; padding: 4px 8px; border-radius: 6px; background: var(--glass-2); } .run.error { color: var(--danger); }
.testout { font-size: 13px; min-height: 18px; } .testout.ok { color: var(--new); } .testout.bad { color: var(--danger); }
.tg { display: flex; flex-direction: column; gap: 8px; } .tg code { background: var(--glass-3); padding: 2px 8px; border-radius: 6px; font-size: 15px; letter-spacing: 1px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding: 16px; }
.map-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--glass-2); transition: .15s; }
.map-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.map-card.cur { border-color: var(--new); }
.cover { height: 110px; background: var(--glass-3) center/cover; position: relative; cursor: pointer; }
.cover.big { height: 150px; border-radius: 14px; cursor: default; }
.cover .badge { position: absolute; top: 8px; right: 8px; } .cover .role { position: absolute; bottom: 6px; left: 8px; font-size: 11px; background: rgba(0,0,0,.55); color: #fff; padding: 1px 8px; border-radius: 99px; }
.map-info { padding: 9px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; } .map-info b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .map-info small { width: 100%; order: 3; }
.map-card.new { display: grid; place-items: center; min-height: 170px; cursor: pointer; border-style: dashed; color: var(--mute); text-align: center; } .map-card.new div { font-size: 34px; }
.members { display: flex; flex-direction: column; gap: 6px; }
.member { display: flex; align-items: center; gap: 10px; } .member .mi { flex: 1; display: flex; flex-direction: column; min-width: 0; } .member select { width: 110px; }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--glass-3); display: grid; place-items: center; overflow: hidden; font-weight: 700; flex: none; } .av img { width: 100%; height: 100%; }
.role-tag { font-size: 12px; color: var(--mute); padding: 2px 10px; background: var(--glass-2); border-radius: 99px; }
.invite { display: flex; gap: 6px; } .invite select { width: 110px; }

/* ---- login ---- */
#login { position: fixed; inset: 0; z-index: 3500; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at center, transparent 30%, rgba(5,8,14,.75)); pointer-events: none; }
.login-card { pointer-events: auto; width: min(400px, 100%); border-radius: 26px; padding: 34px 30px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; animation: pop .5s cubic-bezier(.2,1.2,.4,1); }
.login-card h1 { margin: 0; font-size: 34px; letter-spacing: .5px; }
.login-card .tag { margin: 0; background: none; color: var(--mute); font-size: 14px; padding: 0; }
.login-card svg { color: var(--fg); animation: spin 30s linear infinite; }
.btn.google { background: #fff; color: #1f2937; font-weight: 600; padding: 11px 20px; width: 100%; border: 0; }
.demo { display: flex; flex-direction: column; gap: 8px; width: 100%; } .or { display: flex; align-items: center; gap: 10px; color: var(--mute); font-size: 12px; } .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---- toasts ---- */
#toasts { position: fixed; z-index: 4000; top: 80px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--glass); backdrop-filter: blur(18px); border: 1px solid var(--line); padding: 9px 16px; border-radius: 99px; box-shadow: var(--shadow); animation: rise .25s ease-out; font-size: 13.5px; }
.toast.out { opacity: 0; transition: .4s; }
.toast.err { border-color: var(--danger); } .toast.ok { border-color: var(--new); } .toast.warn { border-color: var(--warn); }
.toast.new { border-color: var(--new); box-shadow: 0 0 22px color-mix(in srgb, var(--new) 45%, transparent); color: var(--new); font-weight: 700; }

@keyframes ring { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes popin { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes pop { from { opacity: 0; transform: scale(.95) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(-12px); } }
@keyframes blink { 50% { opacity: .2; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; } .ev.is-new::after, .cl.is-new::after { display: none; } }

/* ---- móvil ---- */
@media (max-width: 820px) {
  :root { --panel-w: 100vw; }
  .brand b, #btn-new span, .search { display: none; }
  #topbar { top: 8px; left: 8px; right: 8px; }
  #panel { left: 0; right: 0; width: 100%; top: auto; height: 52vh; bottom: 0; border-radius: 20px 20px 0 0; }
  body.panel-hidden #panel { transform: translateY(105%); }
  #panel-toggle { display: grid; top: auto; bottom: calc(52vh + 10px); left: 10px; }
  body.panel-hidden #panel-toggle { bottom: 10px; left: 10px; }
  #legend { display: none; }
  .leaflet-control-scale, .leaflet-bottom.leaflet-left .leaflet-control-attribution { margin-left: 8px !important; }
  .leaflet-bottom.leaflet-right { bottom: 54vh; }
  body.panel-hidden .leaflet-bottom.leaflet-right { bottom: 0; }
  .row2 { grid-template-columns: 1fr; } .tools { grid-template-columns: repeat(2, 1fr); }
}
