/* ================================================================
   GIEDEN CRM – Design System
   Premium dark theme with glassmorphism, smooth transitions
   ================================================================ */

/* ── CSS VARIABLES ────────────────────────────────── */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a2236;
    --bg-card-hover: #1f2a42;
    --bg-sidebar: #0d1321;
    --bg-input: #1a2236;
    --bg-topbar: rgba(10, 14, 26, 0.85);

    --border: #1e293b;
    --border-light: #2a3550;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: rgba(37, 99, 235, 0.15);
    --accent-glow: rgba(37, 99, 235, 0.3);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #38bdf8;
    --info-bg: rgba(56, 189, 248, 0.12);
    --purple: #a855f7;
    --purple-bg: rgba(168, 85, 247, 0.12);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);

    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --topbar-height: 64px;

    --transition: 0.2s ease;
    --transition-slow: 0.35s ease;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── LIGHT THEME OVERRIDES ───────────────────────── */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #e2e8f0;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-input: #f8fafc;
    --bg-topbar: rgba(255, 255, 255, 0.9);

    --border: #e2e8f0;
    --border-light: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: rgba(37, 99, 235, 0.08);
    --accent-glow: rgba(37, 99, 235, 0.15);

    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --info: #0284c7;
    --info-bg: rgba(2, 132, 199, 0.08);
    --purple: #7c3aed;
    --purple-bg: rgba(124, 58, 237, 0.08);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ── RESET & BASE ─────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--info);
}

img {
    max-width: 100%;
    height: auto;
}

/* ── APP LAYOUT ───────────────────────────────────── */
.crm-app {
    display: flex;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-slow);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow), width var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #fff;
    letter-spacing: -0.5px;
}

.logo-text {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.logo-text small {
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 4px;
    vertical-align: middle;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

/* Nav sections */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section {
    padding: 4px 0;
}

.nav-section-title {
    display: block;
    padding: 8px 24px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--accent-light);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-light);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-item i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-external {
    width: 14px !important;
    height: 14px !important;
    opacity: 0.5;
    margin-left: auto;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ── TOPBAR ───────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-topbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.topbar-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.breadcrumb-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    width: 240px;
    transition: all var(--transition);
}

.topbar-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.topbar-search i {
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.topbar-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 100%;
    font-family: var(--font);
}

.topbar-search input::placeholder {
    color: var(--text-muted);
}

.topbar-icon-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.topbar-icon-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: #fff;
}

/* ── PROFILE DROPDOWN ─────────────────────────────── */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 200;
    overflow: hidden;
}

.profile-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font);
    text-align: left;
    text-decoration: none;
}

.profile-dropdown-item:hover {
    background: var(--accent-light);
    color: var(--text-primary);
}

.profile-dropdown-item i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ── CONTENT AREA ─────────────────────────────────── */
.content {
    flex: 1;
    padding: 24px;
}

/* ── CARDS ─────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kpi-card.blue::after {
    background: linear-gradient(90deg, var(--accent), var(--info));
}

.kpi-card.green::after {
    background: linear-gradient(90deg, var(--success), #34d399);
}

.kpi-card.orange::after {
    background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.kpi-card.purple::after {
    background: linear-gradient(90deg, var(--purple), #c084fc);
}

.kpi-card.teal::after {
    background: linear-gradient(90deg, #14b8a6, #2dd4bf);
}

.kpi-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.kpi-info h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.kpi-change {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-change.up {
    color: var(--success);
}

.kpi-change.down {
    color: var(--danger);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon.blue {
    background: var(--accent-light);
    color: var(--accent);
}

.kpi-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-icon.orange {
    background: var(--warning-bg);
    color: var(--warning);
}

.kpi-icon.purple {
    background: var(--purple-bg);
    color: var(--purple);
}

.kpi-icon.teal {
    background: rgba(20, 184, 166, 0.12);
    color: #14b8a6;
}

/* ── CHARTS GRID ──────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-container {
    position: relative;
    height: 280px;
}

/* ── TABLES ───────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
}

.data-table thead th:first-child {
    border-radius: var(--radius) 0 0 0;
}

.data-table thead th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody td:first-child {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── BADGES / STATUS ──────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-available,
.badge-new,
.badge-qualified {
    background: var(--success-bg);
    color: var(--success);
}

.badge-available::before,
.badge-new::before,
.badge-qualified::before {
    background: var(--success);
}

.badge-rented,
.badge-contacted,
.badge-negotiation,
.badge-proposal {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-rented::before,
.badge-contacted::before,
.badge-negotiation::before,
.badge-proposal::before {
    background: var(--accent);
}

.badge-sold,
.badge-won {
    background: var(--purple-bg);
    color: var(--purple);
}

.badge-sold::before,
.badge-won::before {
    background: var(--purple);
}

.badge-maintenance,
.badge-lost {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-maintenance::before,
.badge-lost::before {
    background: var(--danger);
}

.badge-qualification {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-qualification::before {
    background: var(--warning);
}

.badge-residential {
    background: var(--info-bg);
    color: var(--info);
}

.badge-residential::before {
    background: var(--info);
}

.badge-commercial {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-commercial::before {
    background: var(--warning);
}

.badge-high,
.badge-urgent {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-high::before,
.badge-urgent::before {
    background: var(--danger);
}

.badge-medium {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-medium::before {
    background: var(--warning);
}

.badge-low {
    background: var(--success-bg);
    color: var(--success);
}

.badge-low::before {
    background: var(--success);
}

.badge-call {
    background: var(--info-bg);
    color: var(--info);
}

.badge-call::before {
    background: var(--info);
}

.badge-meeting {
    background: var(--purple-bg);
    color: var(--purple);
}

.badge-meeting::before {
    background: var(--purple);
}

.badge-email {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-email::before {
    background: var(--accent);
}

.badge-task,
.badge-follow-up {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-task::before,
.badge-follow-up::before {
    background: var(--warning);
}

.badge-reviewing {
    background: var(--info-bg);
    color: var(--info);
}

.badge-reviewing::before {
    background: var(--info);
}

.badge-approved {
    background: var(--success-bg);
    color: var(--success);
}

.badge-approved::before {
    background: var(--success);
}

.badge-rejected {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-rejected::before {
    background: var(--danger);
}

/* ── BUTTONS ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn i {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}

.btn-icon {
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ── PAGE HEADER ──────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header-left h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-header-left p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── FILTERS BAR ──────────────────────────────────── */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ── FORMS ─────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: all var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-check label {
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0;
    cursor: pointer;
}

/* ── IMAGE UPLOAD ─────────────────────────────────── */
.image-upload-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    background: var(--bg-input);
}

.image-upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.image-upload-zone i {
    color: var(--text-muted);
    margin-bottom: 8px;
}

.image-upload-zone p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.image-upload-zone small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.image-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.image-preview-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/3;
    background: var(--bg-secondary);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-image {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all var(--transition);
}

.image-preview-item .remove-image:hover {
    background: var(--danger);
}

/* ── KANBAN BOARD ─────────────────────────────────── */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    overflow-x: auto;
}

.kanban-column {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-height: 400px;
}

.kanban-column-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kanban-column-header h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kanban-count {
    background: var(--bg-card);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kanban-column-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 65vh;
    overflow-y: auto;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: all var(--transition);
    cursor: pointer;
}

.kanban-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.kanban-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.kanban-card-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── ACTIVITY LIST ────────────────────────────────── */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.activity-item:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

.activity-item.completed {
    opacity: 0.5;
}

.activity-item.completed .activity-title {
    text-decoration: line-through;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.call {
    background: var(--info-bg);
    color: var(--info);
}

.activity-icon.meeting {
    background: var(--purple-bg);
    color: var(--purple);
}

.activity-icon.email {
    background: var(--accent-light);
    color: var(--accent);
}

.activity-icon.task {
    background: var(--warning-bg);
    color: var(--warning);
}

.activity-body {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.activity-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.activity-due {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.activity-due.overdue {
    color: var(--danger);
}

.activity-actions {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

/* ── PROPERTY CARDS ───────────────────────────────── */
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.property-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.property-card:hover {
    border-color: var(--border-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.property-card-image {
    height: 200px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card-hover));
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.property-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-card-image .no-image {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.property-card-image .status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}

.property-card-image .featured-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, var(--warning), #f59e0b);
    color: #000;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-card-body {
    padding: 20px;
}

.property-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.property-card-location {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.property-card-location i {
    width: 14px;
    height: 14px;
}

.property-card-details {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.property-detail {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.property-detail i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.property-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.property-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent);
}

.property-price small {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
}

.property-card-actions {
    display: flex;
    gap: 6px;
}

/* ── EMPTY STATE ──────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state i {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* ── RECENT TABLE IN DASHBOARD ────────────────────── */
.recent-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── MODAL ────────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ── DETAIL PAGE ──────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feature-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Gallery */
.detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.detail-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .recent-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .topbar-toggle {
        display: flex;
    }

    .topbar-search {
        display: none;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .property-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── ANIMATIONS ───────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content>* {
    animation: fadeInUp 0.4s ease both;
}

.content>*:nth-child(2) {
    animation-delay: 0.05s;
}

.content>*:nth-child(3) {
    animation-delay: 0.1s;
}

.content>*:nth-child(4) {
    animation-delay: 0.15s;
}

/* ── ALERT / VALIDATION ──────────────────────────── */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.validation-summary-errors {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 20px;
    color: var(--danger);
    font-size: 0.85rem;
}

.validation-summary-errors ul {
    list-style: none;
    padding: 0;
}

.validation-summary-errors li {
    padding: 2px 0;
}

.field-validation-error {
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

/* ── SCROLLBAR ────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */

/* Background */
.login-body {
    overflow: hidden;
}

.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: var(--bg-primary);
}

.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.45;
    animation: orbFloat 12s ease-in-out infinite;
}

.login-orb-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    top: -10%;
    left: -5%;
    animation-delay: 0s;
}

.login-orb-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    bottom: -10%;
    right: -5%;
    animation-delay: -4s;
}

.login-orb-3 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -8s;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -40px) scale(1.05);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.95);
    }
}

[data-theme="light"] .login-orb {
    opacity: 0.2;
}

/* Container */
.login-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

/* Glass Card */
.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(26, 34, 54, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Logo */
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
}

.login-brand {
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.login-brand-sub {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 6px;
    vertical-align: middle;
}

/* Headings */
.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-subtitle {
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Error */
.login-error {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 24px;
    animation: shake 0.4s ease-in-out;
}

.login-error i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

/* Fields */
.login-field {
    margin-bottom: 20px;
}

.login-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.login-label i {
    width: 15px;
    height: 15px;
    opacity: 0.6;
}

.login-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: all var(--transition);
    outline: none;
}

.login-input::placeholder {
    color: var(--text-muted);
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), 0 0 20px rgba(37, 99, 235, 0.1);
}

/* Password wrapper */
.login-password-wrap {
    position: relative;
}

.login-password-wrap .login-input {
    padding-right: 48px;
}

.login-password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.login-password-toggle:hover {
    color: var(--text-primary);
    background: var(--accent-light);
}

.login-password-toggle i {
    width: 18px;
    height: 18px;
}

/* Options row */
.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

/* Custom checkbox */
.login-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.login-checkbox input {
    display: none;
}

.login-checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 5px;
    position: relative;
    transition: all var(--transition);
    flex-shrink: 0;
}

.login-checkbox input:checked~.login-checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.login-checkbox input:checked~.login-checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Submit Button */
.login-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent), #4f46e5);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.login-btn:hover::before {
    opacity: 1;
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn i {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.login-btn:hover i {
    transform: translateX(4px);
}

.login-btn.loading .login-btn-text {
    opacity: 0;
}

.login-btn.loading i {
    display: none;
}

.login-btn.loading::after {
    content: '';
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    position: absolute;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.login-footer span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px;
        border-radius: 16px;
    }

    .login-title {
        font-size: 1.3rem;
    }

    .login-orb-1 {
        width: 300px;
        height: 300px;
    }

    .login-orb-2 {
        width: 250px;
        height: 250px;
    }

    .login-orb-3 {
        width: 200px;
        height: 200px;
    }
}