/* ============================================================
   VORTEX PH — Estilos (dark premium SaaS)
   ============================================================ */
:root {
  /* Paleta Sea Point — azul océano profundo + oro champagne (seapoint.com.pa) */
  --bg: #06192e;
  --bg2: #08213a;
  --panel: #0b2a46;
  --panel2: #0f3253;
  --panel3: #153c60;
  --line: rgba(248, 250, 252, 0.08);
  --line2: rgba(248, 250, 252, 0.16);
  --text: #f8fafc;
  --muted: #9db0c5;
  --muted2: #62788f;
  --gold: #c7a35a;
  --gold-dark: #a8863f;
  --gold-dim: rgba(199, 163, 90, 0.15);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.14);
  --amber: #f5b84b;
  --amber-dim: rgba(245, 184, 75, 0.14);
  --orange: #fb923c;
  --orange-dim: rgba(251, 146, 60, 0.14);
  --red: #f26d6d;
  --red-dim: rgba(242, 109, 109, 0.14);
  --blue: #6ea8fe;
  --wa: #25d366;
  --wa-bg: #075e54;
  --radius: 20px;
  --radius-sm: 13px;
  --font-display: "Cormorant Garamond", "Times New Roman", serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
/* Red de seguridad: nada se escapa horizontalmente en ninguna pantalla */
html, body { max-width: 100%; overflow-x: hidden; }
/* Los hijos de grid/flex deben poder encoger por debajo de su contenido */
.card, .kpi, .ticket, .list-row, .tpl-card, .dash-col, .dash-col > *,
.dash-grid > *, .res-grid > * { min-width: 0; }
img, svg, textarea, table, pre { max-width: 100%; }
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 420px at 75% -10%, rgba(199, 163, 90, 0.07), transparent 60%),
    radial-gradient(700px 380px at 10% 110%, rgba(13, 52, 84, 0.55), transparent 60%);
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.hidden { display: none !important; }

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; z-index: 1;
}
.login-card {
  width: 100%; max-width: 420px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 26px; padding: 36px 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.brand-mark {
  font-family: var(--font-display); font-weight: 600; letter-spacing: 0.32em;
  font-size: 13px; color: var(--green); text-transform: uppercase;
}
.login-title {
  font-family: var(--font-display); font-weight: 200; font-size: 30px;
  letter-spacing: -0.01em; margin: 10px 0 4px;
}
.login-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.role-cards { display: grid; gap: 10px; margin-bottom: 20px; }
.role-card {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; color: var(--text); transition: border-color 0.15s, background 0.15s;
}
.role-card:hover { border-color: var(--line2); }
.role-card.sel { border-color: var(--green); background: var(--green-dim); }
.role-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; background: var(--panel3); color: var(--green);
}
.role-card .rc-name { font-weight: 600; font-size: 14.5px; }
.role-card .rc-desc { color: var(--muted); font-size: 12.5px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.04em; }
.field input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); padding: 12px 14px; font-size: 15px; outline: none;
}
.field input:focus { border-color: var(--green); }
.btn {
  border: none; border-radius: 12px; padding: 13px 20px; font-size: 14.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--green); color: #06281c; width: 100%; }
.btn-primary:hover { opacity: 0.9; }
.btn-ghost { background: var(--panel3); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--line2); }
.btn-wa { background: var(--wa); color: #052e16; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(242,109,109,.3); }
.login-note {
  margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--bg2);
  border: 1px dashed var(--line2); color: var(--muted); font-size: 12.5px;
}
.otp-row { display: flex; gap: 8px; justify-content: space-between; margin: 18px 0 20px; }
.otp-row input {
  width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 600;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; color: var(--text); outline: none;
}
.otp-row input:focus { border-color: var(--green); }
.sec-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.sec-badge {
  font-size: 11px; color: var(--muted); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 5px;
}

/* ============ APP SHELL ============ */
#app { position: relative; z-index: 1; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 25, 46, 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px;
}
.topbar .brand-mark { font-size: 12px; white-space: nowrap; }
.nav-tabs {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  background: transparent; border: none; color: var(--muted); font-size: 13.5px; font-weight: 500;
  padding: 8px 13px; border-radius: 999px; white-space: nowrap; transition: color 0.15s, background 0.15s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { background: var(--panel3); color: var(--text); }
.nav-tab.locked { opacity: 0.45; }
.topbar-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.session-chip {
  font-size: 11.5px; color: var(--muted); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 11px; display: inline-flex; gap: 6px; align-items: center;
}
.role-chip {
  font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 5px 11px;
  display: inline-flex; gap: 6px; align-items: center;
}
.role-chip.admin { background: var(--green-dim); color: var(--green); border: 1px solid rgba(52,211,153,.3); }
.role-chip.junta { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,184,75,.3); }
.icon-btn {
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 10px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--line2); }

.main { max-width: 1280px; margin: 0 auto; padding: 26px 20px 120px; }

/* ============ DASHBOARD HERO ============ */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 200; font-size: clamp(28px, 4.5vw, 44px);
  letter-spacing: -0.02em; line-height: 1.1;
}
.hero .hero-sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.g { background: var(--green); box-shadow: 0 0 8px rgba(52,211,153,.7); }
.dot.a { background: var(--amber); box-shadow: 0 0 8px rgba(245,184,75,.7); }
.dot.o { background: var(--orange); box-shadow: 0 0 8px rgba(251,146,60,.7); }
.dot.r { background: var(--red); box-shadow: 0 0 8px rgba(242,109,109,.7); }

/* ============ GRID / CARDS ============ */
.dash-grid { display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; gap: 16px; align-items: start; }
.dash-col { display: grid; gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; position: relative;
}
.card-title { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-align: left; color: var(--text); position: relative;
  transition: border-color 0.15s, transform 0.12s; display: block; width: 100%;
}
.kpi:hover { border-color: var(--line2); transform: translateY(-2px); }
.kpi .kpi-icon { font-size: 17px; }
.kpi .kpi-num {
  font-family: var(--font-display); font-weight: 300; font-size: clamp(26px, 3vw, 36px);
  line-height: 1.1; margin: 8px 0 2px;
}
.kpi .kpi-label { color: var(--muted); font-size: 12.5px; }
.kpi .kpi-hint { font-size: 11.5px; margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; }
.kpi .arrow {
  position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 9px;
  background: var(--panel3); color: var(--muted); display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background 0.15s, color 0.15s;
}
.kpi:hover .arrow { background: var(--green); color: #06281c; }
.txt-g { color: var(--green); } .txt-a { color: var(--amber); } .txt-o { color: var(--orange); }
.txt-r { color: var(--red); } .txt-m { color: var(--muted); }

/* ============ EDIFICIO 3D ============ */
.building-card { padding: 20px 20px 14px; }
.building-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.building-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); }
.building-legend span { display: inline-flex; align-items: center; gap: 5px; }
#buildingSvg { width: 100%; height: auto; display: block; }
.floor-front { transition: filter 0.15s; cursor: pointer; }
.floor-g .floor-front { fill: rgba(52, 211, 153, 0.16); stroke: rgba(52, 211, 153, 0.75); }
.floor-g .floor-side { fill: rgba(52, 211, 153, 0.07); stroke: rgba(52, 211, 153, 0.35); }
.floor-r .floor-front { fill: rgba(242, 109, 109, 0.18); stroke: rgba(242, 109, 109, 0.85); }
.floor-r .floor-side { fill: rgba(242, 109, 109, 0.08); stroke: rgba(242, 109, 109, 0.4); }
.floor-group { cursor: pointer; }
.floor-group:hover .floor-front { filter: brightness(1.6); }
.floor-win { fill: rgba(255, 255, 255, 0.16); pointer-events: none; }
.floor-r .floor-win { fill: rgba(255, 255, 255, 0.24); }
.floor-label { fill: var(--muted2); font-size: 10px; font-family: var(--font-body); pointer-events: none; }
.floor-count { font-size: 10px; font-weight: 700; pointer-events: none; }
.ext-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ext-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  color: var(--text); transition: border-color 0.15s;
}
.ext-chip:hover { border-color: var(--line2); }

/* ============ GRÁFICAS / GAUGES ============ */
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }
.gauge-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gauge-box { text-align: center; }
.gauge-box svg { width: 100%; max-width: 130px; }
.gauge-val { font-family: var(--font-display); font-weight: 300; font-size: 22px; margin-top: -34px; }
.gauge-label { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* ============ SECCIONES / MÓDULOS ============ */
.view-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.view-head h2 { font-family: var(--font-display); font-weight: 200; font-size: clamp(24px, 3.5vw, 34px); letter-spacing: -0.01em; }
.view-head .crumb { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.seg-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-tab {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 8px 15px; font-size: 13px; font-weight: 500;
}
.seg-tab.active { background: var(--panel3); color: var(--text); border-color: var(--line2); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.ticket {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: left; color: var(--text); width: 100%;
  display: flex; flex-direction: column; gap: 8px; transition: border-color 0.15s, transform 0.12s;
}
.ticket:hover { border-color: var(--line2); transform: translateY(-2px); }
.ticket-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.ticket-title { font-weight: 600; font-size: 14.5px; }
.ticket-desc { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11.5px; color: var(--muted2); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.chip.cat { background: var(--panel3); color: var(--muted); }
.chip.nuevo { background: var(--red-dim); color: var(--red); }
.chip.proceso { background: var(--amber-dim); color: var(--amber); }
.chip.resuelto { background: var(--green-dim); color: var(--green); }
.chip.lock { background: var(--panel3); color: var(--muted); }
.chip.src { background: rgba(37, 211, 102, 0.1); color: var(--wa); }
.group-title { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 22px 0 10px; }
.group-title:first-child { margin-top: 0; }

/* listas (residentes, comprobantes, auditoría) */
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  width: 100%; text-align: left; color: var(--text); transition: border-color 0.15s;
}
.list-row:hover { border-color: var(--line2); }
.list-col { display: grid; gap: 8px; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; background: var(--panel3);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
  color: var(--green); flex: none;
}
.lr-main { flex: 1; min-width: 0; }
.lr-title { font-weight: 600; font-size: 14px; }
.lr-sub { color: var(--muted); font-size: 12px; }
.lr-end { text-align: right; font-size: 12.5px; }
.money { font-family: var(--font-display); font-weight: 400; font-size: 15px; }

/* plantillas comunicados */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tpl-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.tpl-thumb {
  height: 90px; border-radius: var(--radius-sm); background: var(--panel2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.tpl-kind { position: absolute; top: 26px; right: 26px; }
.tpl-title { font-weight: 600; font-size: 14px; }
.tpl-body { color: var(--muted); font-size: 12px; flex: 1; }

/* votaciones */
.vote-q { margin-bottom: 16px; }
.vote-q .q { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 12px; }
.bar-row .bar-label { width: 110px; color: var(--muted); flex: none; }
.bar-track { flex: 1; height: 8px; border-radius: 99px; background: var(--panel3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; }
.bar-row .bar-val { width: 34px; text-align: right; color: var(--muted); }

/* auditoría */
.audit-row { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; align-items: baseline; }
.audit-row:last-child { border-bottom: none; }
.audit-t { color: var(--muted2); white-space: nowrap; font-size: 11.5px; width: 118px; flex: none; }
.audit-a { font-weight: 600; font-size: 11px; letter-spacing: 0.04em; color: var(--amber); width: 150px; flex: none; }
.audit-d { color: var(--muted); flex: 1; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sec-item { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.sec-item .si-t { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.sec-item .si-d { color: var(--muted); font-size: 12px; }

/* ============ MODALES ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 6, 8, 0.72); backdrop-filter: blur(6px);
  z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 0;
  animation: fadeIn 0.18s ease;
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; padding: 24px; } }
.modal {
  background: var(--panel); border: 1px solid var(--line2); width: 100%; max-width: 680px;
  max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 24px;
  animation: slideUp 0.22s ease;
}
@media (min-width: 640px) { .modal { border-radius: 24px; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-title { font-family: var(--font-display); font-weight: 300; font-size: 22px; letter-spacing: -0.01em; }
.modal-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.modal-x {
  background: var(--panel3); border: none; color: var(--muted); width: 32px; height: 32px;
  border-radius: 10px; font-size: 15px; flex: none;
}
.modal-x:hover { color: var(--text); }
.modal-section { margin-top: 18px; }
.modal-section > .card-title { margin-bottom: 10px; display: block; }

/* burbuja WhatsApp */
.wa-box { background: #0a1512; border: 1px solid rgba(37, 211, 102, 0.2); border-radius: var(--radius-sm); padding: 14px; }
.wa-bubble {
  background: #1f2c24; border-radius: 4px 14px 14px 14px; padding: 10px 12px; font-size: 13.5px;
  max-width: 92%; margin-bottom: 8px; position: relative;
}
.wa-bubble.me { background: var(--wa-bg); border-radius: 14px 4px 14px 14px; margin-left: auto; }
.wa-bubble .wa-from { font-size: 11.5px; font-weight: 700; color: var(--wa); margin-bottom: 3px; }
.wa-bubble .wa-time { font-size: 10px; color: rgba(255,255,255,0.45); text-align: right; margin-top: 4px; }
.wa-media {
  background: rgba(255,255,255,0.06); border-radius: 10px; padding: 18px; text-align: center;
  font-size: 26px; margin-bottom: 6px;
}
.wa-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.wa-photo { display: block; border-radius: 10px; overflow: hidden; line-height: 0; max-width: 100%; }
.wa-photo img {
  display: block; width: 100%; max-width: 240px; max-height: 260px; object-fit: cover;
  border-radius: 10px; cursor: zoom-in; transition: filter .15s ease;
}
.wa-photo:hover img { filter: brightness(1.06); }
.wa-voice { display: flex; align-items: center; gap: 10px; padding: 8px 4px 4px; }
.wa-voice .wv-play { width: 30px; height: 30px; border-radius: 50%; background: var(--wa); color: #052e16; border: none; font-size: 12px; flex: none; }
.wa-voice .wv-wave { display: flex; align-items: center; gap: 2px; flex: 1; height: 22px; }
.wa-voice .wv-wave i { width: 3px; border-radius: 2px; background: rgba(255,255,255,0.4); }
.bot-line {
  display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted);
  padding: 10px 4px 2px;
}
.bot-line .chip { flex: none; }
.spinner {
  width: 14px; height: 14px; border: 2px solid var(--line2); border-top-color: var(--green);
  border-radius: 50%; animation: spin 0.7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* proveedor / acciones ticket */
.prov-list { display: grid; gap: 8px; }
.prov-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--panel2); border: 1px solid var(--line); color: var(--text); width: 100%; text-align: left;
}
.prov-row.sel { border-color: var(--wa); background: rgba(37, 211, 102, 0.08); }
.prov-row .pr-name { font-weight: 600; font-size: 13.5px; }
.prov-row .pr-meta { color: var(--muted); font-size: 11.5px; }
.gen-msg {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px; font-size: 13px; color: var(--text); width: 100%; min-height: 92px; resize: vertical;
}
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.status-select {
  background: var(--panel3); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; outline: none;
}
.timeline { display: grid; gap: 0; }
.tl-item { display: flex; gap: 12px; font-size: 12.5px; padding: 7px 0; }
.tl-item .tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-top: 5px; flex: none; }
.tl-item .tl-t { color: var(--muted2); white-space: nowrap; font-size: 11.5px; min-width: 86px; }
.tl-item .tl-e { color: var(--muted); }

/* ============ FAB / TOAST ============ */
.fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  background: var(--wa); color: #052e16; border: none; border-radius: 999px;
  padding: 15px 20px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 9px;
  box-shadow: 0 12px 36px rgba(37, 211, 102, 0.35);
  transition: transform 0.12s;
}
.fab:hover { transform: translateY(-2px); }
#toastRoot { position: fixed; top: 70px; right: 16px; z-index: 200; display: grid; gap: 8px; max-width: 340px; }
.toast {
  background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--green);
  border-radius: 12px; padding: 12px 16px; font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); animation: slideUp 0.2s ease;
}
.toast.warn { border-left-color: var(--amber); }
.toast.err { border-left-color: var(--red); }

/* ============================================================
   TEMA DÍA (claro) — se activa con [data-theme="day"]
   ============================================================ */
[data-theme="day"] {
  /* Día "perla": marfil cálido + tinta océano + oro más profundo */
  --bg: #f3f1ec;
  --bg2: #ece9e2;
  --panel: #fbfaf7;
  --panel2: #f3f1ea;
  --panel3: #e8e4da;
  --line: rgba(10, 36, 64, 0.10);
  --line2: rgba(10, 36, 64, 0.18);
  --text: #14283c;
  --muted: #5a6b7d;
  --muted2: #97a4b1;
  --gold: #a8863f;
  --gold-dark: #8a6d30;
  --gold-dim: rgba(168, 134, 63, 0.14);
  --green: #0ea86b;
  --green-dim: rgba(14, 168, 107, 0.13);
  --amber: #b9820f;
  --amber-dim: rgba(185, 130, 15, 0.14);
  --orange: #de6f1c;
  --orange-dim: rgba(222, 111, 28, 0.13);
  --red: #d8484a;
  --red-dim: rgba(216, 72, 74, 0.12);
  --blue: #2f6fed;
}
[data-theme="day"] body::before {
  background:
    radial-gradient(900px 420px at 75% -10%, rgba(168, 134, 63, 0.08), transparent 60%),
    radial-gradient(700px 380px at 10% 110%, rgba(13, 52, 84, 0.06), transparent 60%);
}
[data-theme="day"] .topbar { background: rgba(251, 250, 247, 0.85); }
[data-theme="day"] .card,
[data-theme="day"] .kpi,
[data-theme="day"] .ticket,
[data-theme="day"] .list-row,
[data-theme="day"] .tpl-card,
[data-theme="day"] .login-card,
[data-theme="day"] .modal {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px rgba(15, 23, 42, 0.06);
}
[data-theme="day"] .btn-primary { color: #071a2e; }
[data-theme="day"] .btn-wa { background: #25d366; color: #05391f; }
[data-theme="day"] .modal-backdrop { background: rgba(20, 24, 33, 0.5); }
/* edificio en modo día */
[data-theme="day"] .floor-g .floor-front { fill: rgba(14, 168, 107, 0.14); stroke: rgba(14, 168, 107, 0.8); }
[data-theme="day"] .floor-g .floor-side { fill: rgba(14, 168, 107, 0.06); stroke: rgba(14, 168, 107, 0.3); }
[data-theme="day"] .floor-r .floor-front { fill: rgba(216, 72, 74, 0.14); stroke: rgba(216, 72, 74, 0.85); }
[data-theme="day"] .floor-r .floor-side { fill: rgba(216, 72, 74, 0.06); stroke: rgba(216, 72, 74, 0.32); }
[data-theme="day"] .floor-win { fill: rgba(15, 23, 42, 0.13); }
[data-theme="day"] .floor-r .floor-win { fill: rgba(15, 23, 42, 0.2); }
/* WhatsApp en modo día (look claro auténtico) */
[data-theme="day"] .wa-box { background: #eae6df; border-color: rgba(15, 23, 42, 0.08); }
[data-theme="day"] .wa-bubble { background: #ffffff; color: #111b21; }
[data-theme="day"] .wa-bubble.me { background: #d9fdd3; color: #111b21; }
[data-theme="day"] .wa-bubble .wa-time { color: #667781; }
[data-theme="day"] .wa-media { background: rgba(15, 23, 42, 0.05); }
[data-theme="day"] .wa-voice .wv-wave i { background: rgba(15, 23, 42, 0.35); }

/* from-label del chat (clase, no estilo inline, para poder tematizar) */
.wa-bubble .wa-from { color: var(--wa); }
.wa-bubble.me .wa-from { color: #9fe8c4; }
[data-theme="day"] .wa-bubble .wa-from { color: #047857; }
[data-theme="day"] .wa-bubble.me .wa-from { color: #047857; }

/* ============ NOTIFICACIONES ============ */
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: -5px; right: -5px; background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700; min-width: 15px; height: 15px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px; border: 1.5px solid var(--bg);
}
.notif-row { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: flex-start; }
.notif-row:last-child { border-bottom: none; }
.notif-row .ni { font-size: 17px; flex: none; }
.notif-row.unread { background: var(--green-dim); border-radius: 10px; padding: 12px; border-bottom: none; margin-bottom: 4px; }
.notif-row .nt { color: var(--muted2); font-size: 11px; margin-top: 3px; }

/* ============ CALENDARIO / RESERVAS ============ */
.res-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 16px; align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head .card-title { text-transform: capitalize; font-size: 15px; letter-spacing: 0; color: var(--text); font-family: var(--font-display); font-weight: 300; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-dow { text-align: center; font-size: 10.5px; color: var(--muted2); font-weight: 700; padding-bottom: 4px; letter-spacing: 0.04em; }
.cal-cell {
  aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 11px; padding: 5px 6px;
  background: var(--panel2); display: flex; flex-direction: column; gap: 2px; cursor: pointer;
  transition: border-color 0.12s, transform 0.1s;
}
.cal-cell:hover { border-color: var(--line2); transform: translateY(-1px); }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell.empty:hover { transform: none; }
.cal-cell.today { border-color: var(--green); background: var(--green-dim); }
.cal-cell .cal-day { font-size: 12px; color: var(--muted); }
.cal-cell.has .cal-day { color: var(--text); font-weight: 700; }
.cal-cell.today .cal-day { color: var(--green); font-weight: 700; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: auto; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: none; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 14px; font-size: 11px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.res-item { display: flex; gap: 12px; align-items: center; }
.res-time { font-family: var(--font-display); font-weight: 400; font-size: 13px; color: var(--text); text-align: center; min-width: 52px; flex: none; line-height: 1.25; }
.res-time small { display: block; color: var(--muted2); font-size: 10.5px; }
.res-space-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--panel3); display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none; }
.chip.conflicto { background: var(--red-dim); color: var(--red); }
.chip.cancelada { background: var(--panel3); color: var(--muted2); text-decoration: line-through; }
.chip.pendiente { background: var(--amber-dim); color: var(--amber); }
.chip.confirmada { background: var(--green-dim); color: var(--green); }
.res-form { display: grid; gap: 12px; margin-top: 8px; }
.res-form label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; }
.res-form select, .res-form input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px;
  color: var(--text); padding: 11px 13px; font-size: 14px; outline: none;
}
.res-form select:focus, .res-form input:focus { border-color: var(--green); }
.res-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ============ MENÚ MÓVIL (hamburguesa + drawer) ============ */
.menu-btn { display: none; font-size: 17px; flex: none; }
.current-module {
  display: none; font-family: var(--font-display); font-weight: 300; font-size: 17px;
  letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.nav-drawer { position: fixed; inset: 0; z-index: 120; }
.nav-drawer.hidden { display: none; }
.nav-drawer-overlay { position: absolute; inset: 0; background: rgba(5, 6, 8, 0.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadeIn 0.18s ease; }
.nav-drawer-panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 86%; max-width: 320px;
  background: var(--panel); border-right: 1px solid var(--line2); padding: 16px 12px;
  overflow-y: auto; animation: slideInLeft 0.22s ease; box-shadow: 24px 0 60px rgba(0, 0, 0, 0.45);
}
@keyframes slideInLeft { from { transform: translateX(-100%); } }
.ndp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding: 6px 6px 0; }
.ndp-brand { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.28em; font-size: 12px; color: var(--green); text-transform: uppercase; }
.drawer-link {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; background: transparent;
  border: 1px solid transparent; border-radius: 14px; padding: 15px 14px; color: var(--text);
  font-size: 15.5px; font-weight: 500; margin-bottom: 2px; transition: background 0.12s;
}
.drawer-link:hover { background: var(--panel2); }
.drawer-link.active { background: var(--green-dim); border-color: rgba(52, 211, 153, 0.3); color: var(--green); }
.drawer-link.locked { opacity: 0.5; }
.drawer-link .dl-ico { font-size: 19px; width: 24px; text-align: center; flex: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .menu-btn { display: flex; }
  .nav-tabs { display: none; }
  .brand-mark { display: none; }
  .current-module { display: block; }
  .session-chip { display: none; }
  .role-chip .rc-txt { display: none; }
  .role-chip { padding: 6px 9px; }
}
@media (max-width: 980px) {
  .dash-grid { grid-template-columns: 1fr; }
  .res-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .gauge-row { max-width: 440px; margin: 0 auto; }
}
@media (max-width: 640px) {
  .main { padding: 18px 14px 130px; }
  .topbar-inner { padding: 10px 14px; gap: 10px; }
  .topbar .brand-mark { display: none; }
  .session-chip { display: none; }
  .kpi { padding: 14px; }
  .modal { padding: 18px; }
  .audit-a { width: auto; }
  .audit-row { flex-wrap: wrap; }
  .fab span { display: none; }
  .fab { padding: 16px; }
}

/* ============================================================
   SEA POINT — identidad de lujo (azul océano + oro champagne)
   ============================================================ */

/* ---------- Login: lobby cinco estrellas (siempre océano, día y noche) ---------- */
.login-wrap {
  background:
    radial-gradient(1100px 520px at 82% -12%, rgba(199, 163, 90, 0.16), transparent 62%),
    radial-gradient(900px 620px at 10% 112%, rgba(13, 52, 84, 0.85), transparent 70%),
    linear-gradient(165deg, #06192e 0%, #0d3454 52%, #07223b 100%);
}
.login-wrap .login-card {
  max-width: 460px;
  background: rgba(6, 22, 40, 0.72);
  border: 1px solid rgba(199, 163, 90, 0.22);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 40px 120px rgba(2, 10, 20, 0.6), inset 0 1px 0 rgba(248, 250, 252, 0.06);
}

/* Crest: monograma en anillo dorado + wordmark serif + eslogan */
.crest { text-align: center; margin-bottom: 22px; }
.crest-ring {
  width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 50%;
  border: 1px solid rgba(199, 163, 90, 0.65);
  box-shadow: 0 0 0 5px rgba(199, 163, 90, 0.08), inset 0 0 18px rgba(199, 163, 90, 0.14);
  display: flex; align-items: center; justify-content: center;
}
.crest-ring span {
  font-family: var(--font-display); font-size: 26px; font-weight: 500;
  letter-spacing: 0.12em; margin-right: -0.12em; color: #c7a35a;
}
.crest-word {
  font-family: var(--font-display); font-size: 30px; font-weight: 500;
  letter-spacing: 0.3em; margin-right: -0.3em; color: #f8fafc; line-height: 1.15;
}
.crest-slogan {
  font-family: var(--font-display); font-style: italic; font-size: 15px;
  color: #c7a35a; letter-spacing: 0.1em; margin-top: 3px;
}
.crest-divider {
  width: 46px; height: 1px; margin: 14px auto 10px;
  background: linear-gradient(90deg, transparent, rgba(199, 163, 90, 0.8), transparent);
}
.login-wrap .login-sub {
  color: #7f92a8; font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; margin-bottom: 0;
}

/* Interior del login: siempre modo océano aunque la app esté en modo día */
.login-wrap .role-cards { margin-top: 22px; }
.login-wrap .role-card { background: rgba(248, 250, 252, 0.04); border-color: rgba(248, 250, 252, 0.09); color: #f8fafc; }
.login-wrap .role-card:hover { border-color: rgba(199, 163, 90, 0.45); }
.login-wrap .role-card.sel { border-color: #c7a35a; background: rgba(199, 163, 90, 0.12); }
.login-wrap .role-avatar { background: rgba(199, 163, 90, 0.12); color: #c7a35a; font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.login-wrap .rc-desc { color: #93a5bb; }
.login-wrap .field label { color: #93a5bb; }
.login-wrap .otp-row input { background: rgba(3, 12, 22, 0.6); border-color: rgba(248, 250, 252, 0.12); color: #f8fafc; }
.login-wrap .otp-row input:focus { border-color: #c7a35a; box-shadow: 0 0 0 3px rgba(199, 163, 90, 0.15); }
.login-wrap .btn-primary {
  background: linear-gradient(135deg, #d6b878, #c7a35a 45%, #a8863f);
  color: #071a2e; letter-spacing: 0.14em; text-transform: uppercase;
  font-size: 13px; font-weight: 700;
}
.login-wrap .login-note { background: rgba(3, 12, 22, 0.5); border-color: rgba(199, 163, 90, 0.28); color: #93a5bb; }
.login-wrap .sec-badge { background: rgba(3, 12, 22, 0.5); border-color: rgba(248, 250, 252, 0.08); color: #7f92a8; }
.login-wrap .login-card { box-shadow: 0 40px 120px rgba(2, 10, 20, 0.6), inset 0 1px 0 rgba(248, 250, 252, 0.06); }
.powered-by { text-align: center; margin-top: 18px; font-size: 10.5px; color: #5f7189; letter-spacing: 0.08em; }
.powered-by span { color: #93a5bb; letter-spacing: 0.2em; }

/* ---------- Acentos oro champagne en la app ---------- */
.brand-mark, .ndp-brand { color: var(--gold); }
.btn-primary { background: linear-gradient(135deg, #d6b878, var(--gold) 45%, var(--gold-dark)); color: #071a2e; }
.nav-tab.active { background: var(--gold-dim); color: var(--gold); }
.drawer-link.active { background: var(--gold-dim); border-color: rgba(199, 163, 90, 0.35); color: var(--gold); }
.role-chip.admin { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(199, 163, 90, 0.35); }
.avatar, .role-avatar { color: var(--gold); }
.kpi:hover .arrow { background: var(--gold); color: #071a2e; }
.spinner { border-top-color: var(--gold); }
.cal-cell.today { border-color: var(--gold); background: var(--gold-dim); }
.cal-cell.today .cal-day { color: var(--gold); font-weight: 700; }
.field input:focus, .otp-row input:focus,
.res-form select:focus, .res-form input:focus { border-color: var(--gold); }
.ext-chip:hover { border-color: rgba(199, 163, 90, 0.45); }

/* Serif Cormorant: pesos con presencia (los 200/300 de Sora no existen en serif) */
.hero h1, .view-head h2 { font-weight: 500; }
.modal-title, .kpi .kpi-num, .gauge-val, .current-module, .cal-head .card-title { font-weight: 500; }
.money, .res-time { font-weight: 600; }
.brand-mark { font-weight: 600; }

/* ---------- Login multi-usuario + torres ---------- */
.role-cards.many { grid-template-columns: repeat(2, 1fr); }
.role-cards.many .role-card { padding: 10px 12px; }
.role-cards.many .rc-desc { font-size: 11.5px; }
@media (max-width: 480px) {
  .role-cards.many { grid-template-columns: 1fr; }
}
.role-chip.funcionario { background: rgba(96, 165, 250, 0.12); color: var(--blue); border: 1px solid rgba(96, 165, 250, 0.3); }
.tower-label { fill: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.6px; }
