/* Panel MyProperties — mismo lenguaje visual que la agenda y la cotización:
   azul de marca, tinta oscura, fondo gris azulado, Outfit para títulos y Figtree para texto.
   Es una herramienta de trabajo: densa donde hace falta (tablas), tranquila en lo demás. */
:root {
  color-scheme: light;
  --bg: #F4F6FB; --card: #FFFFFF; --ink: #12141B; --muted: #5A6070; --faint: #9AA1B2; --line: #E3E7F0; --line2: #EDF0F6;
  --brand: #1A52E3; --brand-ink: #FFFFFF; --brand-soft: #E7EDFD; --roof: #FF6B1F;
  --ok: #157F4A; --ok-soft: #E3F4EA; --warn: #9A5B00; --warn-soft: #FFF3D6; --bad: #B42318; --bad-soft: #FDE8E7; --gray-soft: #EEF0F4;
  --font-display: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Figtree", "Helvetica Neue", Arial, sans-serif;
  --r: 14px; --shadow: 0 1px 2px rgba(18,20,27,.05), 0 4px 16px rgba(18,20,27,.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.cargando { padding: 40px; text-align: center; color: var(--muted); }
.eyebrow { font-family: var(--font-display); font-size: 11.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* ---------- Acceso ---------- */
.acceso { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.acceso form { width: min(400px, 100%); background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.acceso img { width: 170px; height: auto; margin-bottom: 4px; }
.acceso h1 { font-size: 24px; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; }
.side .logo { width: 150px; height: auto; margin: 2px 10px 18px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; }
.side a:hover { background: var(--bg); }
.side a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side a .pronto { margin-left: auto; font-size: 11px; color: var(--faint); font-weight: 500; }
.side .user { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.side .user b { color: var(--ink); display: block; font-weight: 600; }
.ico { width: 18px; height: 18px; flex: none; }
main { padding: 26px 32px 80px; max-width: 1200px; width: 100%; }
.topbar { display: none; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { font-size: 28px; }
.head .sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 8px; }
.back:hover { color: var(--brand); }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .side.abierto { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar img { width: 130px; height: auto; }
  main { padding: 18px 16px 90px; }
  .head h1 { font-size: 24px; }
}
.velo { position: fixed; inset: 0; background: rgba(18,20,27,.35); z-index: 35; }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 14px; min-height: 40px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #C9D0DE; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.pri:hover { background: #1546C6; }
.btn.peligro { color: var(--bad); }
.btn.mini { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.icono { padding: 8px; min-width: 40px; }
label.campo { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
label.campo .ayuda { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=month], input[type=url], input[type=time], input[type=date], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 11px; font-size: 15px; font-weight: 400; min-height: 40px;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,82,227,.14); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.error-msg { color: var(--bad); font-size: 14px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.card > .sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.seccion { display: flex; flex-direction: column; gap: 14px; }

/* Lista de proyectos */
.proyectos { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.pcard:hover { border-color: #C9D0DE; box-shadow: var(--shadow); }
.pcard .portada { aspect-ratio: 16 / 7; background: linear-gradient(160deg, #A9CBE0, #146B9C); display: grid; place-items: center; position: relative; }
.pcard .portada img.render { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pcard .portada .logo-chip { position: relative; background: rgba(255,255,255,.94); border-radius: 12px; padding: 10px 14px; }
.pcard .portada .logo-chip img { height: 34px; width: auto; display: block; }
.pcard .cuerpo { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.pcard h3 { font-size: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--gray-soft); color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.azul { background: var(--brand-soft); color: var(--brand); }
.stock { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--gray-soft); }
.stock span { display: block; }
.stock .d { background: var(--ok); } .stock .r { background: #E5A00D; } .stock .v { background: var(--faint); } .stock .b { background: #6B7280; }
.leyenda { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.leyenda i { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 5px; vertical-align: 1px; }
.desde { display: flex; justify-content: space-between; align-items: baseline; }
.desde b { font-family: var(--font-display); font-size: 20px; color: var(--brand); }
.nuevo { border: 1.5px dashed #C9D0DE; background: transparent; border-radius: 18px; min-height: 200px; color: var(--muted); font-weight: 600; display: grid; place-items: center; }
.nuevo:hover { border-color: var(--brand); color: var(--brand); }

/* Pestañas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { font-family: var(--font-display); font-size: 22px; display: block; }
.stat span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Tabla de unidades */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filtros .seg { display: inline-flex; background: var(--gray-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.filtros .seg button { border: 0; background: transparent; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filtros .seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(18,20,27,.12); }
.tabla-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFD; position: sticky; top: 0; }
.tabla td { padding: 9px 12px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr { cursor: pointer; }
.tabla tbody tr:hover td { background: #FAFBFD; }
.tabla tr.sel td { background: var(--brand-soft); }
.tabla .r { text-align: right; }
.tabla td.chk, .tabla th.chk { width: 40px; padding-right: 0; }
.tabla input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }
.tabla .depto { font-weight: 700; }
.estado { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.estado.disponible { background: var(--ok-soft); color: var(--ok); }
.estado.reservada { background: var(--warn-soft); color: var(--warn); }
.estado.vendida { background: var(--gray-soft); color: var(--muted); }
.estado.bloqueada { background: #E5E7EB; color: #374151; }
.manual { font-size: 11px; font-weight: 700; color: var(--brand); margin-left: 4px; }
.aviso-ico { color: var(--warn); font-weight: 700; margin-left: 4px; }
.lote { position: sticky; bottom: 16px; z-index: 20; margin-top: 12px; background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; box-shadow: 0 8px 24px rgba(18,20,27,.25); }
.lote .btn { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.lote .btn:hover { background: rgba(255,255,255,.2); }
.lote b { margin-right: 6px; }

/* Panel lateral de edición */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--card); z-index: 50; box-shadow: -8px 0 30px rgba(18,20,27,.18); display: flex; flex-direction: column; }
.drawer .dh { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer .dh h2 { font-size: 20px; }
.drawer .db { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.drawer .df { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; }
.velo.drawer-velo { z-index: 45; }
.precio-calc { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }

/* Barra de guardar (formularios) */
.guardar-bar { position: sticky; bottom: 16px; margin-top: 18px; display: flex; justify-content: flex-end; gap: 10px; align-items: center; z-index: 10; }
.guardar-bar .pendiente { background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }

/* Modelos y planos */
.modelos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.modelo { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.modelo .plano { aspect-ratio: 4 / 3; background: var(--bg); position: relative; display: grid; place-items: center; border: 0; padding: 0; width: 100%; }
.modelo .plano img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.modelo .plano .subir { font-size: 13px; color: var(--muted); font-weight: 600; text-align: center; padding: 12px; }
.modelo .plano:hover .subir, .modelo .plano:hover::after { color: var(--brand); }
.modelo .info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.modelo .info h3 { font-size: 17px; }
.imagen-box { border: 1.5px dashed #C9D0DE; border-radius: 12px; background: var(--bg); display: grid; place-items: center; min-height: 150px; position: relative; overflow: hidden; }
.imagen-box img { max-width: 100%; max-height: 220px; display: block; }

/* Lista simple (lugares, historial) */
.lista { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.lista .item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line2); }
.lista .item:last-child { border-bottom: 0; }
.lista .item h3 { font-size: 16px; }
.cambio { font-size: 14px; }
.cambio time { color: var(--muted); font-size: 12.5px; display: block; }

/* Diálogo */
dialog.dlg { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(18,20,27,.3); }
dialog.dlg::backdrop { background: rgba(18,20,27,.45); }
.dlg form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { font-size: 20px; }
.dlg .acciones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Avisos */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 100; box-shadow: 0 8px 24px rgba(18,20,27,.3); max-width: calc(100vw - 32px); }
#toast.error { background: var(--bad); }
.nota-box { background: var(--warn-soft); color: #6B4200; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.info-box { background: var(--brand-soft); color: #173C9E; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.vacio { text-align: center; color: var(--muted); padding: 40px 16px; }
code.clave { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--bg); padding: 8px 10px; border-radius: 8px; display: block; word-break: break-all; }
.diff-up { color: var(--bad); } .diff-down { color: var(--ok); }
