/* ImmoOnline — design system */
:root {
  --brand: #4f46e5;
  --brand-2: #06b6d4;
  --brand-soft: rgba(79, 70, 229, .10);
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --text: #1b1f3b;
  --muted: #6b7280;
  --line: #e7e9f3;
  --sidebar-w: 260px;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 64, .04), 0 8px 24px rgba(16, 24, 64, .06);
  --bs-body-font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-bs-theme="dark"] {
  --brand: #818cf8;
  --brand-soft: rgba(129, 140, 248, .14);
  --bg: #0d1020;
  --surface: #151933;
  --surface-2: #1a1f3d;
  --text: #e8eaf6;
  --muted: #9aa0c0;
  --line: #262b4d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--line);
}

body { background: var(--bg); color: var(--text); font-size: .95rem; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 1.25rem 1rem; transition: transform .25s ease;
}
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: .65rem; font-size: 1.25rem; color: var(--text); padding: .25rem .5rem 1.25rem; letter-spacing: -.01em; }
.brand b { color: var(--brand); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 1.1rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}
.side-nav { flex: 1; overflow-y: auto; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; margin: 1.1rem .6rem .4rem; }
.nav-item-link {
  display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: 12px;
  color: var(--muted); font-weight: 500; transition: background .15s, color .15s;
}
.nav-item-link i { font-size: 1.1rem; }
.nav-item-link:hover { background: var(--surface-2); color: var(--text); }
.nav-item-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding-top: .75rem; }

.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1.5rem; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); display: grid; place-items: center; font-size: 1.1rem; cursor: pointer;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.user-chip { display: flex; align-items: center; gap: .5rem; padding: .25rem .75rem .25rem .3rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; font-size: .88rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .85rem; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.scrim { display: none; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(10, 12, 30, .5); z-index: 1035; }
  .content { padding: 1rem; }
  .topbar { padding: .75rem 1rem; }
}

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 1rem 1.25rem; font-weight: 700; display: flex; align-items: center; gap: .6rem; }
.card-header i { color: var(--brand); }
.card-body { padding: 1.25rem; }

.kpi { padding: 1.25rem; display: flex; flex-direction: row; align-items: center; gap: 1rem; height: 100%; transition: transform .2s, box-shadow .2s; }
.kpi:hover { transform: translateY(-3px); }
.kpi-icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 1.5rem; flex: none; }
.kpi-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.tone-indigo { background: rgba(79, 70, 229, .12); color: #6366f1; }
.tone-red { background: rgba(239, 68, 68, .12); color: #ef4444; }
.tone-green { background: rgba(16, 185, 129, .13); color: #10b981; }
.tone-amber { background: rgba(245, 158, 11, .14); color: #f59e0b; }
.tone-cyan { background: rgba(6, 182, 212, .13); color: #06b6d4; }

.hero {
  border-radius: var(--radius); padding: 1.5rem 1.75rem; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 55%, #06b6d4 120%); box-shadow: 0 14px 34px rgba(79, 70, 229, .3);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hero h2 { font-weight: 800; letter-spacing: -.02em; }
.hero .btn { position: relative; z-index: 1; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .85rem 1rem; border-bottom-color: var(--line); vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { background: var(--brand-soft); color: var(--text); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.thumb-ph { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line); }
td[contenteditable="true"] { cursor: text; border-radius: 8px; transition: background .15s, box-shadow .15s; }
td[contenteditable="true"]:hover { background: var(--surface-2); }
td[contenteditable="true"]:focus { outline: none; background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
td.saved { animation: flashOk .9s ease; }
@keyframes flashOk { from { background: rgba(16, 185, 129, .35); } to { background: transparent; } }

/* ---------- Badges / buttons / forms ---------- */
.badge-soft { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-soft::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(16, 185, 129, .14); color: #10b981; }
.badge-danger { background: rgba(239, 68, 68, .14); color: #ef4444; }
.badge-secondary { background: rgba(107, 114, 128, .16); color: var(--muted); }
.badge-warning { background: rgba(245, 158, 11, .16); color: #f59e0b; }

.btn { border-radius: 12px; font-weight: 600; padding: .55rem 1rem; }
.btn-sm { border-radius: 10px; padding: .35rem .7rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3; box-shadow: 0 6px 16px rgba(79, 70, 229, .25); }
.btn-soft { background: var(--brand-soft); color: var(--brand); border: 0; }
.btn-soft:hover { background: var(--brand); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.form-control, .form-select { border-radius: 12px; border-color: var(--line); background-color: var(--surface); padding: .6rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem var(--brand-soft); }
.form-label { font-weight: 600; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.search-box { position: relative; }
.search-box i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .form-control { padding-left: 2.5rem; }
.alert { border-radius: 14px; border: 0; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .6; }
.page-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.pagination .page-link { border-radius: 10px; margin: 0 2px; border-color: var(--line); color: var(--text); background: var(--surface); }
.pagination .active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; }
.toast-i { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #10b981; box-shadow: var(--shadow); border-radius: 12px; padding: .7rem 1rem; animation: slideIn .25s ease; font-weight: 600; }
.toast-i.err { border-left-color: #ef4444; }
@keyframes slideIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  background: linear-gradient(140deg, #312e81 0%, #4f46e5 45%, #06b6d4 130%); color: #fff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-art::before, .auth-art::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.auth-art::before { width: 420px; height: 420px; right: -140px; bottom: -120px; }
.auth-art::after { width: 220px; height: 220px; left: -70px; top: 30%; }
.auth-art h2 { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; position: relative; z-index: 1; }
.auth-art ul { list-style: none; padding: 0; margin: 1.5rem 0 0; position: relative; z-index: 1; }
.auth-art li { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; opacity: .92; }
.auth-form { display: grid; place-items: center; padding: 2rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .no-print, .toast-wrap, .scrim { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}
