/* InmoSuite - sistema de diseno neutro white-label */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #0284c7;
  --info-bg: #e0f2fe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: linear-gradient(160deg, var(--brand) 0%, #6d28d9 100%); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-hero::after { content: ''; position: absolute; inset: 0; background: radial-gradient(600px 400px at 80% 20%, rgba(255,255,255,.12), transparent); }
.login-hero h1 { font-size: 40px; font-weight: 800; letter-spacing: -1px; margin-bottom: 16px; position: relative; }
.login-hero p { font-size: 17px; opacity: .9; max-width: 440px; line-height: 1.6; position: relative; }
.login-hero .feat { margin-top: 40px; display: grid; gap: 14px; position: relative; }
.login-hero .feat div { display: flex; align-items: center; gap: 12px; font-size: 15px; opacity: .95; }
.login-hero .feat span { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 14px; }
.login-form-side { display: grid; place-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .logo { font-weight: 800; font-size: 24px; color: var(--brand); margin-bottom: 6px; letter-spacing: -.5px; }
.login-card .sub { color: var(--muted); margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; transition: .15s; }
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.demo-users { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 18px; }
.demo-users .dh { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 10px; }
.demo-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px; cursor: pointer; transition: .12s; }
.demo-user:hover { border-color: var(--brand); background: var(--brand-50); }
.demo-user .av { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.demo-user .nm { font-weight: 600; font-size: 13px; }
.demo-user .rl { font-size: 12px; color: var(--muted); }
.err-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #0f1729; color: #cbd5e1; padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { font-weight: 800; font-size: 20px; color: #fff; padding: 6px 10px 22px; letter-spacing: -.5px; display: flex; align-items: center; gap: 9px; }
.sidebar .brand .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; font-size: 15px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #64748b; padding: 16px 12px 6px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; font-weight: 500; color: #cbd5e1; margin-bottom: 2px; transition: .12s; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .ic { width: 18px; text-align: center; opacity: .9; }
.sidebar .spacer { flex: 1; }
.side-user { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.side-user .av { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.side-user .nm { font-size: 13px; font-weight: 600; color: #fff; }
.side-user .rl { font-size: 12px; color: #94a3b8; }
.side-user .logout { margin-left: auto; color: #94a3b8; font-size: 16px; padding: 4px; }
.side-user .logout:hover { color: #fff; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 16px 28px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.topbar .crumb { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.content { padding: 26px 28px; max-width: 1400px; width: 100%; }

/* ---------- Cards / KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.kpi .lab { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .val { font-size: 28px; font-weight: 800; letter-spacing: -1px; margin-top: 8px; }
.kpi .val.sm { font-size: 22px; }
.kpi .delta { font-size: 12px; margin-top: 4px; color: var(--muted); }
.kpi .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card .card-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card .card-h h3 { font-size: 15px; font-weight: 700; }
.card .card-h .r { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card .card-b { padding: 18px 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 1000px){ .grid-2,.grid-3 { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .sidebar { display:none; } }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
.t-wrap { overflow-x: auto; }
.t-name { font-weight: 600; }
.t-sub { font-size: 12px; color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-danger { background: var(--danger-bg); color: var(--danger); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-gray { background: #f1f5f9; color: var(--muted); }
.b-brand { background: var(--brand-50); color: var(--brand); }
.dot-est { width:8px; height:8px; border-radius:50%; display:inline-block; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 260px; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.kcol { background: #eef1f7; border-radius: 12px; padding: 10px; min-height: 200px; }
.kcol-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 10px; font-weight: 700; font-size: 13px; }
.kcol-h .cnt { background: #fff; color: var(--muted); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow-sm); transition: .12s; }
.kcard:hover { border-color: var(--brand); transform: translateY(-1px); }
.kcard .kn { font-weight: 600; font-size: 13px; }
.kcard .km { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Bars (charts sin libs) ---------- */
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 90px; align-items: center; gap: 12px; }
.bar-row .bl { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #eef1f7; border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.bar-row .bv { text-align: right; font-weight: 700; font-size: 13px; }
.funnel { display: grid; gap: 8px; }
.fstep { display: flex; align-items: center; gap: 12px; }
.fbar { height: 34px; border-radius: 8px; background: var(--brand); display: flex; align-items: center; padding: 0 12px; color: #fff; font-weight: 700; font-size: 13px; min-width: 44px; transition: width .4s; }
.fstep .fl { width: 110px; font-size: 13px; font-weight: 600; text-transform: capitalize; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.lg { max-width: 820px; }
.modal-h { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-h h3 { font-size: 17px; font-weight: 700; }
.modal-h .x { margin-left: auto; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-b { padding: 22px 24px; }
.modal-f { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- misc ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search { flex: 1; min-width: 200px; position: relative; }
.search input { width: 100%; padding: 10px 13px 10px 36px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.search::before { content: '🔍'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .5; font-size: 13px; }
select.filter { padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 500; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.pill-tabs { display: flex; gap: 6px; background: #eef1f7; padding: 4px; border-radius: 10px; }
.pill-tabs button { padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.pill-tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 11px; box-shadow: var(--shadow); font-weight: 500; z-index: 200; animation: slideup .25s; }
.toast.err { background: var(--danger); }
@keyframes slideup { from { transform: translateY(12px); opacity: 0; } }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { display:grid; grid-template-columns: 1fr auto; gap:6px; align-items:center; }
.tag-origin { font-size:12px; color:var(--muted); }
.link { color: var(--brand); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.hint { background: var(--info-bg); color: var(--info); padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; display:flex; gap:8px; }
.stat-inline { display:flex; gap:22px; flex-wrap:wrap; }
.stat-inline .s .n { font-size: 22px; font-weight: 800; }
.stat-inline .s .l { font-size: 12px; color: var(--muted); }
