:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface2: #f0f1f4;
    --border: #dfe1e6;
    --text: #1a1f2b;
    --text-dim: #6b7280;
    --blue: #2563eb;
    --green: #16a34a;
    --purple: #7c3aed;
    --red: #dc2626;
    --radius: 8px;
    --sidebar-width: 340px;
}

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

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100%;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg);
    box-shadow: 2px 0 12px rgba(0, 0, 0, .08);
    z-index: 2;
    display: flex;
    flex-direction: column;
}

/* ─── Header (dark gradient) ─── */
.header {
    background: linear-gradient(135deg, #1a1f2b, #2d3348);
    padding: 14px 18px;
    color: #fff;
    position: relative;
}

.header h1 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: -0.3px;
}

.header h1 span {
    font-size: 10px;
    color: rgba(255, 255, 255, .4);
    font-weight: 400;
}

.header p {
    font-size: 12px;
    color: rgba(255, 255, 255, .55);
}

.header .lead-badge {
    display: inline-block;
    background: rgba(255, 255, 255, .15);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, .85);
}

/* Menu button */
.menu-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(255, 255, 255, .12);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, .22);
}

/* ─── Navigation Menu (dropdown) ─── */
.nav-menu {
    background: #252a3a;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease, padding .3s ease;
    padding: 0 14px;
}

.nav-menu.open {
    max-height: 350px;
    padding: 10px 14px 14px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    transition: all .15s;
    margin-bottom: 2px;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.nav-menu a.active {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}

.nav-menu .nav-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
}

/* ─── Filter Panel ─── */
.filters {
    padding: 14px 16px;
    flex: 1;
    overflow-y: auto;
    background: var(--bg);
}

.filter-section {
    margin-bottom: 14px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 14px 0;
}

/* Search */
#search-input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 10px center;
    transition: border-color .2s;
    margin-bottom: 0;
}

#search-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

/* Dropdowns */
#user-filter,
#region-filter,
#stage-filter {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    margin-bottom: 0;
    transition: border-color .2s;
}

#user-filter:focus,
#region-filter:focus {
    outline: none;
    border-color: var(--blue);
}

/* Stage checkboxes */
.stage-checkbox-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    margin-bottom: 2px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    transition: background .15s;
}

.stage-checkbox-item:hover {
    background: rgba(37, 99, 235, .06);
}

.stage-checkbox-item:last-child {
    margin-bottom: 0;
}

.stage-checkbox-item input {
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--blue);
}

.stage-checkbox-item label {
    cursor: pointer;
    flex: 1;
    font-weight: 500;
}

/* Total filtered */
#total-filtered-count {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}

/* Date inputs */
.date-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    font-family: var(--font);
    background: var(--surface);
    transition: border-color .2s;
}

.date-input:focus {
    outline: none;
    border-color: var(--blue);
}

/* Rent / Keymoney Filter */
.rent-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    margin-bottom: 2px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    transition: all .15s;
    border: 1px solid transparent;
}

.rent-category-item:hover {
    background: rgba(37, 99, 235, .06);
    border-color: rgba(37, 99, 235, .15);
}

.rent-category-item.active {
    background: #dcfce7;
    border-color: var(--green);
    color: #166534;
    font-weight: 600;
}

.rent-category-item .rc-label {
    flex: 1;
}

.rent-category-item .rc-count {
    background: var(--surface2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    min-width: 26px;
    text-align: center;
}

.rent-category-item.active .rc-count {
    background: var(--green);
    color: white;
}

/* Leads list placeholder */
.leads-list {
    flex: 0;
    overflow-y: auto;
    padding: 0;
}

/* ─── Map ─── */
#map {
    flex: 1;
    height: 100%;
}

/* ─── InfoWindow ─── */
.gm-style .gm-style-iw-c {
    padding: 0;
    border-radius: 8px;
}

.info-window {
    width: 300px;
    padding: 10px;
}

.info-window.has-sidebar {
    width: 550px;
    display: flex;
    gap: 20px;
}

.main-info {
    flex: 1;
}

.side-column {
    flex: 1;
    border-left: 1px solid #ddd;
    padding-left: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-card {
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
}

.info-card h4 {
    margin-top: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .1);
    padding-bottom: 5px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.info-card.competitor {
    background: #fff9c4;
}

.info-card.competitor h4 {
    color: #f57c00;
}

.info-card.traffic {
    background: #e3f2fd;
}

.info-card.traffic h4 {
    color: #1565c0;
}

.info-window h3 {
    margin-bottom: 5px !important;
    font-size: 16px;
    margin-top: 0 !important;
}

.info-window p {
    margin: 0 !important;
    margin-bottom: 2px !important;
    font-size: 14px;
    line-height: 1.15 !important;
}

.comments-section {
    margin: 10px 0;
    padding: 8px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 12px;
    color: #555;
    max-height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Tags */
.tag-online {
    display: inline-block;
    background: var(--green);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 5px;
    vertical-align: middle;
    text-transform: uppercase;
}

.tag-competitor {
    display: inline-block;
    background: #ff9800;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 5px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* Buttons */
.info-window .links {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.btn-link {
    display: inline-block;
    padding: 6px 12px;
    background: var(--blue);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
}

.btn-link.secondary {
    background: #eee;
    color: #333;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    margin-top: 20px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.drop-zone:hover,
.drop-zone.active {
    border-color: var(--blue);
    background: #f0f7ff;
}

.drop-text h3 {
    font-size: 16px;
    color: var(--blue);
    margin-bottom: 5px;
}

.drop-text p {
    font-size: 13px;
    color: #888;
}

.lead-item {
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.lead-item:hover {
    border-color: var(--blue);
    background: #f0f7ff;
}

.lead-item h3 {
    font-size: 16px;
    margin-bottom: 5px;
    font-weight: 600;
}

.lead-item .price {
    font-weight: 500;
    color: #2e7d32;
    font-size: 14px;
}

.lead-item .status {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    background: #eee;
    border-radius: 12px;
    margin-top: 8px;
    color: #666;
}

/* Data Controls */
.data-controls {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 10px;
}

.control-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.control-btn.primary {
    background: #e3f2fd;
    color: #1976d2;
}

.control-btn.primary:hover {
    background: #bbdefb;
}

.control-btn.danger {
    background: #ffebee;
    color: #d32f2f;
}

.control-btn.danger:hover {
    background: #ffcdd2;
}

/* ─── Responsive ─── */
@media (max-height: 900px) {
    .sidebar {
        overflow-y: auto;
    }

    .leads-list {
        overflow-y: visible;
        flex: none;
        height: auto;
    }
}

/* ─── Leaflet Marker Colors ─── */
.marker-color.hue-dark-green img {
    filter: hue-rotate(100deg) saturate(1.5);
}

.marker-color.hue-yellow img {
    filter: hue-rotate(175deg) saturate(2) brightness(1.1);
}

.marker-color.hue-red img {
    filter: hue-rotate(320deg) saturate(2.5);
}

.marker-color.hue-black img {
    filter: brightness(0) saturate(0);
}