*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0b0e14;
    --bg-secondary: #141820;
    --bg-card: #1a1f2e;
    --bg-card-alt: #1e2436;
    --bg-hover: #252d40;
    --accent: #4f8cff;
    --accent-light: #6ba1ff;
    --accent-glow: rgba(79,140,255,.2);
    --purple: #7c3aed;
    --green: #34d399;
    --green-bg: rgba(52,211,153,.12);
    --orange: #fb923c;
    --orange-bg: rgba(251,146,60,.12);
    --red: #f87171;
    --red-bg: rgba(248,113,113,.12);
    --yellow: #fbbf24;
    --text-primary: #e8eaed;
    --text-secondary: #8b95a5;
    --text-muted: #5c6575;
    --border: #1e2538;
    --border-light: #2a3348;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,.3);
    --transition: .2s cubic-bezier(.4,0,.2,1);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* HEADER */
.header {
    background: linear-gradient(135deg, #131829 0%, #0d1018 100%);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(16px);
}
.header-content { max-width: 1500px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.logo { display: flex; align-items: center; gap: .85rem; }
.logo-icon { display: flex; }
.logo h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.logo .subtitle { font-size: .78rem; color: var(--text-secondary); margin-top: 1px; }
.header-actions { display: flex; align-items: center; gap: .6rem; }

.btn-icon {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); width: 38px; height: 38px;
    border-radius: var(--radius-sm); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); transform: rotate(45deg); }

.view-toggle { display: flex; background: var(--bg-card); border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; }
.view-btn {
    background: none; border: none; color: var(--text-muted);
    padding: .5rem .65rem; cursor: pointer; display: flex; align-items: center;
    transition: var(--transition);
}
.view-btn:hover { color: var(--text-primary); }
.view-btn.active { background: var(--accent); color: #fff; }

/* NAV TABS */
.nav-tabs {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
}
.nav-content { max-width: 1500px; margin: auto; display: flex; gap: .25rem; }
.nav-tab {
    background: none; border: none; color: var(--text-secondary);
    padding: .85rem 1.2rem; cursor: pointer; font-family: inherit;
    font-size: .85rem; font-weight: 500; display: flex; align-items: center; gap: .45rem;
    border-bottom: 2px solid transparent; transition: var(--transition);
}
.nav-tab:hover { color: var(--text-primary); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* CONTAINER */
.container { max-width: 1500px; margin: auto; padding: 1.5rem 2rem 3rem; }

/* KPI CARDS */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.2rem 1rem;
    display: flex; align-items: center; gap: 1rem;
    transition: var(--transition); position: relative; overflow: hidden;
}
.kpi-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    opacity: 0; transition: var(--transition);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.kpi-card:hover::before { opacity: 1; }
.kpi-icon { font-size: 1.8rem; flex-shrink: 0; }
.kpi-info { display: flex; flex-direction: column; min-width: 0; }
.kpi-number { font-size: 1.35rem; font-weight: 800; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label { font-size: .72rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }

/* CHARTS */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1rem; }
.chart-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem; overflow: hidden;
}
.chart-title { font-size: .9rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-primary); }
.chart-body { min-height: 200px; }
.chart-body-tall { min-height: 320px; }

/* BAR CHART (CSS) */
.bar-chart { display: flex; flex-direction: column; gap: .45rem; }
.bar-row { display: flex; align-items: center; gap: .6rem; }
.bar-label { font-size: .75rem; color: var(--text-secondary); width: 100px; flex-shrink: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 24px; background: var(--bg-primary); border-radius: 6px; overflow: hidden; position: relative; }
.bar-fill {
    height: 100%; border-radius: 6px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    transition: width .6s cubic-bezier(.4,0,.2,1);
    display: flex; align-items: center; padding-left: .5rem;
    min-width: fit-content;
}
.bar-fill span { font-size: .7rem; font-weight: 600; color: #fff; white-space: nowrap; }
.bar-value { font-size: .75rem; color: var(--text-muted); width: 45px; text-align: right; flex-shrink: 0; }

.bar-fill.color-green { background: linear-gradient(90deg, #059669, var(--green)); }
.bar-fill.color-orange { background: linear-gradient(90deg, #d97706, var(--orange)); }
.bar-fill.color-purple { background: linear-gradient(90deg, #6d28d9, var(--purple)); }
.bar-fill.color-red { background: linear-gradient(90deg, #dc2626, var(--red)); }

/* DONUT CHART (CSS) */
.donut-chart { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.donut-visual {
    width: 140px; height: 140px; border-radius: 50%; flex-shrink: 0;
    position: relative; display: flex; align-items: center; justify-content: center;
}
.donut-center { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); position: absolute; }
.donut-legend { display: flex; flex-direction: column; gap: .4rem; flex: 1; min-width: 140px; }
.legend-item { display: flex; align-items: center; gap: .5rem; font-size: .78rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-label { color: var(--text-secondary); flex: 1; }
.legend-value { color: var(--text-primary); font-weight: 600; }

/* FILTERS */
.filters-section {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.filters-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.filters-header h2 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: .45rem; }
.filters-actions { display: flex; align-items: center; gap: .75rem; }
.results-badge {
    background: var(--accent-glow); color: var(--accent);
    padding: .3rem .75rem; border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.btn-clear {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-secondary); padding: .4rem .85rem;
    border-radius: var(--radius-sm); cursor: pointer; font-size: .78rem; font-family: inherit;
    transition: var(--transition); display: flex; align-items: center; gap: .35rem;
}
.btn-clear:hover { border-color: var(--red); color: var(--red); }

.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .85rem; }
.filter-wide { grid-column: span 2; }
.filter-group label {
    display: block; font-size: .7rem; color: var(--text-secondary);
    margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 500;
}
.filter-group select, .filter-group input {
    width: 100%; padding: .5rem .7rem;
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: .82rem; font-family: inherit;
    transition: var(--transition); appearance: auto;
}
.filter-group select:focus, .filter-group input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-input-wrapper { position: relative; }
.search-input-wrapper .search-icon {
    position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.search-input-wrapper input { padding-left: 2.2rem; }

/* TABLE */
.table-section {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.table-wrapper { overflow-x: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
thead { position: sticky; top: 0; z-index: 10; }
th {
    background: var(--bg-card); padding: .7rem .55rem;
    text-align: left; font-weight: 600; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary);
    border-bottom: 2px solid var(--border); cursor: pointer; user-select: none;
    white-space: nowrap; transition: var(--transition);
}
th:hover { color: var(--accent); }
th .sort-icon { margin-left: 3px; opacity: .4; font-size: .65rem; }
th.sorted .sort-icon { opacity: 1; color: var(--accent); }
td { padding: .55rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr { transition: background .15s; cursor: pointer; }
tr:hover { background: var(--bg-hover); }

.cell-price { font-weight: 600; color: var(--green); white-space: nowrap; font-size: .78rem; }
.cell-discount { font-weight: 700; font-size: .82rem; }
.discount-high { color: var(--green); }
.discount-mid { color: var(--orange); }
.discount-low { color: var(--text-muted); }
.cell-link a {
    color: var(--accent); text-decoration: none;
    padding: .25rem .6rem; border: 1px solid var(--accent);
    border-radius: 6px; font-size: .72rem; transition: var(--transition); white-space: nowrap;
}
.cell-link a:hover { background: var(--accent); color: #fff; }
.cell-modalidade {
    display: inline-block; padding: .2rem .5rem; border-radius: 6px;
    font-size: .7rem; font-weight: 500;
    background: var(--accent-glow); color: var(--accent); white-space: nowrap;
}
.cell-desc { font-size: .75rem; color: var(--text-secondary); line-height: 1.35; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-type {
    display: inline-block; padding: .15rem .45rem; border-radius: 5px;
    font-size: .7rem; font-weight: 500;
    background: rgba(124,58,237,.15); color: #a78bfa;
}
.cell-rooms { font-weight: 600; text-align: center; }

/* CARDS VIEW */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.property-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; cursor: pointer;
    transition: var(--transition);
}
.property-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-light); }
.card-header {
    padding: 1rem 1rem .5rem;
    display: flex; justify-content: space-between; align-items: flex-start;
}
.card-type { font-size: .7rem; font-weight: 600; color: #a78bfa; background: rgba(124,58,237,.15); padding: .15rem .5rem; border-radius: 5px; }
.card-discount {
    font-size: .85rem; font-weight: 800; padding: .15rem .5rem; border-radius: 5px;
}
.card-discount.high { color: var(--green); background: var(--green-bg); }
.card-discount.mid { color: var(--orange); background: var(--orange-bg); }
.card-discount.low { color: var(--text-muted); background: rgba(92,101,117,.12); }

.card-body { padding: .5rem 1rem 1rem; }
.card-price { font-size: 1.4rem; font-weight: 800; color: var(--green); margin-bottom: .15rem; }
.card-eval { font-size: .75rem; color: var(--text-muted); text-decoration: line-through; margin-bottom: .6rem; }
.card-address { font-size: .78rem; color: var(--text-secondary); margin-bottom: .3rem; line-height: 1.4; }
.card-city { font-size: .75rem; color: var(--text-muted); margin-bottom: .75rem; }
.card-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-tag { font-size: .68rem; padding: .15rem .4rem; border-radius: 4px; background: var(--bg-primary); color: var(--text-secondary); border: 1px solid var(--border); }
.card-footer { display: flex; justify-content: space-between; align-items: center; }
.card-modality { font-size: .7rem; color: var(--accent); font-weight: 500; }
.card-link {
    font-size: .75rem; padding: .35rem .75rem;
    background: var(--accent); color: #fff; border: none; border-radius: 6px;
    text-decoration: none; font-weight: 600; transition: var(--transition);
}
.card-link:hover { background: var(--accent-light); transform: scale(1.03); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .5; }
.empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .4rem; }
.empty-sub { font-size: .85rem; color: var(--text-muted); }

/* LOADING */
.loading { display: flex; flex-direction: column; align-items: center; padding: 6rem 2rem; gap: .75rem; }
.spinner-container { position: relative; width: 52px; height: 52px; }
.spinner {
    width: 52px; height: 52px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin .8s linear infinite;
}
.spinner-ring {
    position: absolute; top: -4px; left: -4px;
    width: 60px; height: 60px; border: 2px solid transparent;
    border-top-color: var(--purple); border-radius: 50%;
    animation: spin 1.4s linear infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: .95rem; font-weight: 500; color: var(--text-primary); }
.loading-sub { font-size: .8rem; color: var(--text-muted); }

/* PAGINATION */
.pagination {
    display: flex; justify-content: center; align-items: center;
    padding: 1rem; gap: .35rem; flex-wrap: wrap;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); margin-top: 1rem;
}
.pagination button {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-primary); padding: .4rem .7rem;
    border-radius: 6px; cursor: pointer; font-size: .78rem; font-family: inherit;
    transition: var(--transition);
}
.pagination button:hover { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: .35; cursor: default; pointer-events: none; }
.page-info { color: var(--text-secondary); font-size: .78rem; margin: 0 .4rem; }

/* MODAL */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px); z-index: 1000;
    display: none; align-items: center; justify-content: center;
    padding: 2rem; animation: fadeIn .2s;
}
.modal-overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 16px; max-width: 640px; width: 100%;
    max-height: 80vh; overflow-y: auto; position: relative;
    animation: slideUp .25s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } }
.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); width: 34px; height: 34px;
    border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); z-index: 1;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }
.modal-body { padding: 2rem; }
.modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: .3rem; }
.modal-subtitle { font-size: .82rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.modal-price-row { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.modal-price { font-size: 2rem; font-weight: 800; color: var(--green); }
.modal-eval { font-size: 1rem; color: var(--text-muted); text-decoration: line-through; }
.modal-discount { font-size: 1rem; font-weight: 700; }
.modal-details { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1.5rem; }
.modal-detail { background: var(--bg-card); border-radius: var(--radius-sm); padding: .75rem; }
.modal-detail-label { font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.modal-detail-value { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.modal-desc { font-size: .85rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 1.5rem; padding: 1rem; background: var(--bg-card); border-radius: var(--radius-sm); }
.modal-action {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--accent); color: #fff; padding: .65rem 1.5rem;
    border-radius: var(--radius-sm); text-decoration: none;
    font-weight: 600; font-size: .9rem; transition: var(--transition);
}
.modal-action:hover { background: var(--accent-light); transform: scale(1.02); }

/* FOOTER */
.footer {
    text-align: center; padding: 2rem; color: var(--text-muted);
    font-size: .78rem; border-top: 1px solid var(--border);
}
.footer a { color: var(--accent); text-decoration: none; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .header { padding: .85rem 1rem; }
    .header-content { flex-wrap: wrap; }
    .container { padding: 1rem; }
    .filters-grid { grid-template-columns: 1fr; }
    .filter-wide { grid-column: span 1; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .cards-grid { grid-template-columns: 1fr; }
    .nav-tabs { padding: 0 1rem; }
    .modal-details { grid-template-columns: 1fr; }
}
