:root {
  color-scheme: light;
  --fondo: #f3f5f9; --panel: #ffffff; --borde: #dde3ec; --texto: #172033; --suave: #64708a;
  --acento: #1f5fd1; --acento-suave: #e8f0ff; --oro: #e2a623; --peligro: #c2364f; --verde: #1e9e62;
  --sombra: 0 1px 2px rgba(23,32,51,.06), 0 4px 14px rgba(23,32,51,.06);
  --radio: 14px;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--fondo); color: var(--texto); }
[hidden] { display: none !important; }
button, .boton { font: inherit; border: 1px solid var(--borde); background: var(--panel); color: var(--texto); border-radius: 10px; padding: 7px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover { border-color: #b9c4d6; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, .sala:focus-visible, .tarjeta:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--acento) 45%, transparent); outline-offset: 2px; }
.primario { background: var(--acento); border-color: var(--acento); color: #fff; font-weight: 600; }
.primario:hover { background: #1a52b6; border-color: #1a52b6; }
.secundario { background: var(--panel); }
.peligro { color: var(--peligro); }
.grande { padding: 12px 22px; font-size: 16px; border-radius: 12px; }
.mini { padding: 3px 10px; font-size: 12px; border-radius: 999px; }
.enlace { border: 0; background: none; color: var(--acento); padding: 4px 0; margin-top: 10px; }
.espacio { flex: 1; }
.suave { color: var(--suave); }
input, select { font: inherit; border: 1px solid var(--borde); border-radius: 9px; padding: 7px 10px; background: #fff; color: var(--texto); }
label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
label.interruptor { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }

/* ---- login and welcome ---- */
#ingreso, #entrar { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #e7efff, var(--fondo) 60%); z-index: 50; padding: 16px; }
#entrar { background: rgba(23,32,51,.45); backdrop-filter: blur(3px); }
.tarjeta-ingreso { background: var(--panel); border-radius: 20px; box-shadow: 0 20px 60px rgba(23,32,51,.18); padding: 36px 40px; max-width: 440px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.tarjeta-ingreso h1, .tarjeta-ingreso h2 { margin: 0; }
.tarjeta-ingreso p { margin: 0; color: var(--suave); }
.logo { width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, var(--acento), #13336f); color: var(--oro); font-size: 36px; display: grid; place-items: center; }
.error { color: var(--peligro) !important; }

/* ---- top bar ---- */
.barra { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--borde); }
.marca { font-size: 16px; } .marca span { color: var(--oro); }
.donde { color: var(--suave); }
.yo { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.yo img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
main { padding: 20px; }

/* ---- office plan ---- */
#mapa { max-width: 1400px; margin: 0 auto; }
.fila-salas { display: grid; gap: 14px; margin-bottom: 14px; }
.fila-salas.fijas { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.fila-salas.comunes { grid-template-columns: 1fr; }
.fila-salas.proyectos { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.titulo-seccion { margin: 18px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); }
.sala { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); min-height: 190px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.sala:hover { border-color: #b6c6e3; }
.sala.aqui { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave), var(--sombra); }
.sala header { display: flex; align-items: center; gap: 8px; }
.sala header b { font-size: 15px; }
.sala .cuenta:not(:empty) { background: var(--acento-suave); color: var(--acento); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 700; }
.sala.tipo-fija header b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--acento); margin-right: 7px; vertical-align: 2px; }
.sala.tipo-comun { background: linear-gradient(180deg, #fff9ec, #fff); border-color: #f0dfb4; min-height: 210px; }
.sala.tipo-comun header b::before { content: "☕ "; }
.sala.tipo-proyecto header b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--oro); margin-right: 7px; vertical-align: 1px; }
.sala.nueva { border-style: dashed; box-shadow: none; background: transparent; color: var(--acento); font-weight: 600; justify-content: center; align-items: center; min-height: 120px; }
.personas { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px 6px; padding-top: 12px; }

/* ---- bubbles (from AgentOffice) ---- */
.burbuja { position: relative; width: 68px; height: 68px; margin: 0 22px 34px 6px; --habla: 0; flex: none; }
.burbuja .b-cara { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, #3d8bf0, #1756b8); color: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 0 0 calc(3px + var(--habla) * 5px) color-mix(in srgb, var(--verde) calc(var(--habla) * 100%), #ffffff), 0 3px 10px rgba(23,32,51,.18); transition: box-shadow .08s linear; }
.burbuja .b-cara img, .burbuja .b-cara video { width: 100%; height: 100%; object-fit: cover; }
.burbuja .b-cara video { transform: scaleX(-1); }
.burbuja .b-nombre { position: absolute; left: 34px; top: 74px; transform: translateX(-50%); font-size: 12px; font-weight: 600; white-space: nowrap; background: rgba(255,255,255,.95); border: 1px solid var(--borde); border-radius: 999px; padding: 0 8px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.burbuja.silenciada .b-nombre::after { content: " · silenciada"; color: var(--suave); font-weight: 400; }
.burbuja.comparte .b-nombre::before { content: "🖥 "; }
.burbuja.en-pasillo { width: 48px; height: 48px; margin: 0 8px 30px 4px; opacity: .55; }
.burbuja.en-pasillo .b-cara { font-size: 16px; }
.burbuja.en-pasillo .b-nombre { left: 24px; top: 52px; font-weight: 500; }
.burbuja.propia.con-controles { margin-right: 56px; margin-top: 30px; margin-bottom: 64px; }
.burbuja .b-controles { position: absolute; inset: 0; pointer-events: none; }
.burbuja .b-ctl { position: absolute; width: 30px; height: 30px; padding: 0; border-radius: 50%; display: grid; place-items: center; pointer-events: auto; background: #fff; box-shadow: 0 2px 8px rgba(23,32,51,.18); }
.burbuja .b-ctl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.burbuja .b-ctl:hover { background: #edf4ff; }
.burbuja .b-ctl.activo { background: var(--acento); border-color: var(--acento); color: #fff; }
.burbuja .b-ctl.c-mic.activo { background: var(--peligro); border-color: var(--peligro); }
.burbuja .b-ctl.c-salir { color: var(--peligro); }
.burbuja .c-mic { left: 54px; top: -30px; } .burbuja .c-cam { left: 76px; top: 0; }
.burbuja .c-pantalla { left: 76px; top: 38px; } .burbuja .c-salir { left: 54px; top: 68px; }
.burbuja.con-controles .b-nombre { top: 102px; }
.burbuja .b-mini { position: absolute; left: 34px; top: 126px; transform: translateX(-50%); width: 132px; display: grid; gap: 2px; justify-items: center; z-index: 2; }
.burbuja .b-mini video { width: 132px; aspect-ratio: 16 / 9; object-fit: contain; background: #0f1724; border-radius: 8px; border: 2px solid var(--acento); }
.burbuja .b-mini small { font-size: 11px; font-weight: 600; color: var(--acento); background: rgba(255,255,255,.95); border-radius: 999px; padding: 0 6px; }
.burbuja.propia.comparte { margin-bottom: 150px; }

/* ---- people of my room under a board ---- */
#dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; display: flex; justify-content: center; align-items: flex-start; gap: 10px; padding: 34px 20px 0; height: 170px; background: linear-gradient(180deg, rgba(243,245,249,0), var(--fondo) 30%); }
body[data-vista="tablero"] main { padding-bottom: 190px; }
#dock .burbuja.propia.comparte .b-mini { left: 150px; top: 0; transform: none; }

/* ---- shared screen panel (from AgentOffice) ---- */
#pantallaCompartida { position: fixed; z-index: 20; left: 0; top: 72px; width: 640px; max-width: calc(100vw - 16px); background: #0f1724; border-radius: 14px; overflow: hidden; box-shadow: 0 18px 50px rgba(15,23,36,.35); }
#pantallaCompartida header { cursor: move; user-select: none; touch-action: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; color: #fff; font-size: 13px; }
#pantallaCompartida header button { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; padding: 4px 10px; border-radius: 999px; }
#pantallaCompartida video { display: block; width: 100%; max-height: 72vh; object-fit: contain; background: #000; }
#pantallaCompartida.minimizado { width: 280px !important; }
#pantallaCompartida.minimizado video { max-height: 160px; }
#pantallaCompartida .pc-borde { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none; background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,.55) 50%, rgba(255,255,255,.55) 58%, transparent 58%, transparent 70%, rgba(255,255,255,.55) 70%, rgba(255,255,255,.55) 78%, transparent 78%); }
#pantallaCompartida.arrastrando { user-select: none; box-shadow: 0 24px 60px rgba(15,23,36,.45); }
#pantallaCompartida.arrastrando video { pointer-events: none; }

/* ---- board ---- */
.tb-cab { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tb-cab h2 { margin: 0; font-size: 18px; }
.tb-cab input[type=search] { min-width: 240px; }
.etiqueta { background: #fff4d6; color: #7a5600; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; }
.kanban.agrupado { grid-template-columns: 150px repeat(var(--cols), minmax(190px, 1fr)); gap: 8px 12px; }
.col { min-width: 0; }
.col-cab { display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 4px 4px 8px; }
.col-cab .cuenta { color: var(--suave); font-weight: 600; font-size: 12px; }
.kmas { margin-left: auto; width: 26px; height: 26px; padding: 0; justify-content: center; border-radius: 8px; font-size: 16px; font-weight: 700; color: var(--acento); }
.celda { min-height: 90px; background: #e9edf4; border-radius: 12px; padding: 8px; display: grid; gap: 8px; align-content: start; transition: background .12s; }
.celda.sobre { background: var(--acento-suave); outline: 2px dashed var(--acento); }
.carril-cab { display: flex; align-items: flex-start; padding-top: 10px; }
.vacio { grid-column: 1 / -1; color: var(--suave); }
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 8px 10px; box-shadow: var(--sombra); cursor: grab; display: grid; gap: 6px; }
.tarjeta.arrastrando { opacity: .4; }
.t-num { color: var(--suave); font-size: 12px; font-weight: 700; }
.t-titulo { font-weight: 600; overflow-wrap: anywhere; }
.tarjeta footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tarjeta footer:empty { display: none; }
.chip { --c: #64748b; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: color-mix(in srgb, var(--c) 80%, #000); background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); border-radius: 999px; padding: 1px 8px; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.t-imgs { font-size: 12px; color: var(--suave); }
.t-resp { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; background: #dbe6fb; color: var(--acento); font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---- modals ---- */
dialog#modal { border: 0; border-radius: 18px; padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 30px 80px rgba(23,32,51,.3); color: var(--texto); }
dialog#modal::backdrop { background: rgba(23,32,51,.45); }
.md { display: grid; gap: 14px; padding: 18px 22px 20px; }
.md header { display: flex; align-items: center; gap: 10px; }
.md header h3 { margin: 0; font-size: 17px; flex: 1; }
.md .x { border: 0; font-size: 22px; line-height: 1; padding: 2px 8px; }
.md footer { display: flex; align-items: center; gap: 8px; }
.md .fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.md .lbl { font-weight: 600; font-size: 13px; margin-bottom: -8px; }
.md .meta { margin: 0; font-size: 12px; }
.nuevo-cliente { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; background: var(--fondo); border-radius: 10px; }
.paleta { display: inline-flex; gap: 4px; }
.color { --c: #000; display: inline-block; cursor: pointer; }
.color input { position: absolute; opacity: 0; pointer-events: none; }
.color span { display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--borde); }
.color input:checked + span { box-shadow: 0 0 0 2px var(--texto); }
.color input:focus-visible + span { outline: 2px solid var(--acento); outline-offset: 2px; }
.lista-clientes, .lista-archivadas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lista-clientes li, .lista-archivadas li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lista-clientes li input { flex: 1; min-width: 120px; }

/* ---- rich editor and image viewer (from AgentOffice) ---- */
.rt { position: relative; border: 1px solid var(--borde); border-radius: 10px; background: #fff; overflow: hidden; }
.rt-barra { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border-bottom: 1px solid var(--borde); background: #f8fafc; }
.rt-barra button { padding: 3px 9px; font-size: 13px; }
.rt-ayuda { margin-left: auto; font-size: 12px; color: var(--suave); }
.rt-editor { min-height: 140px; max-height: 46vh; overflow: auto; padding: 10px 12px; outline: none; line-height: 1.5; }
.rt-editor:empty::before { content: attr(data-placeholder); color: var(--suave); }
.rt-editor img, .rt-vista img { display: block; max-width: 100%; height: auto; margin: 8px 0; border-radius: 8px; border: 1px solid var(--borde); }
.rt-editor img { cursor: pointer; }
.rt-editor img.rt-sel { outline: 3px solid var(--acento); outline-offset: 2px; }
.rt-editor h3, .rt-vista h3 { font-size: 16px; margin: 8px 0 4px; }
.rt-vista { padding: 12px 14px; border: 1px solid var(--borde); border-radius: 12px; background: #fff; line-height: 1.5; max-height: 52vh; overflow: auto; }
.rt-vista p { margin: 0 0 8px; }
.rt-vista img { cursor: zoom-in; }
.rt-img { position: absolute; pointer-events: none; }
.rt-img-tamanos { position: absolute; left: 6px; top: 6px; display: flex; gap: 4px; pointer-events: auto; }
.rt-img-tamanos button { padding: 2px 8px; font-size: 12px; border-radius: 999px; background: rgba(255,255,255,.95); box-shadow: 0 2px 8px rgba(23,53,99,.2); }
.rt-img-borde { position: absolute; right: -7px; bottom: -7px; width: 16px; height: 16px; border-radius: 4px; background: var(--acento); border: 2px solid #fff; cursor: nwse-resize; pointer-events: auto; touch-action: none; }
#visorImagen { position: fixed; inset: 0; z-index: 1000; background: rgba(10,16,28,.88); display: flex; flex-direction: column; }
#visorImagen .vi-barra { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: #fff; font-size: 13px; }
#visorImagen .vi-medida { margin-right: auto; opacity: .8; }
#visorImagen .vi-barra button, #visorImagen .vi-abrir { background: rgba(255,255,255,.14); border: 0; color: #fff; padding: 6px 12px; border-radius: 999px; text-decoration: none; font-size: 13px; }
#visorImagen .vi-lienzo { flex: 1; overflow: auto; display: grid; place-items: center; padding: 0 16px 16px; }
#visorImagen img { max-width: 100%; max-height: calc(100vh - 80px); cursor: zoom-in; border-radius: 6px; background: #fff; }
#visorImagen.real .vi-lienzo { display: block; }
#visorImagen.real img { display: block; margin: 0 auto; max-width: none; max-height: none; cursor: zoom-out; }

/* ---- notices ---- */
#aviso { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 2000; background: #172033; color: #fff; border-radius: 12px; padding: 10px 16px; box-shadow: 0 10px 30px rgba(23,32,51,.3); max-width: min(560px, calc(100vw - 32px)); }

@media (max-width: 720px) {
  main { padding: 12px; }
  .barra { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .donde { order: 5; width: 100%; }
  .kanban { grid-template-columns: repeat(5, minmax(220px, 80vw)); }
}
