/* ═══════════════════════════════════════════════════════════════════════════
   Simple Storage Solutions — AI Dashboard CSS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Dark Theme (Default) ───────────────────────────────────────────── */
:root,
[data-theme="dark"] {
    --brand: #2563eb;
    --brand-light: #3b82f6;
    --brand-glow: rgba(37, 99, 235, .15);
    --brand-dark: #1d4ed8;
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1f2937;
    --surface-3: #374151;
    --border: rgba(255, 255, 255, .08);
    --border-hover: rgba(255, 255, 255, .15);
    --text: #f9fafb;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    --green: #10b981;
    --green-glow: rgba(16, 185, 129, .15);
    --orange: #f59e0b;
    --orange-glow: rgba(245, 158, 11, .15);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, .15);
    --purple: #8b5cf6;
    --purple-glow: rgba(139, 92, 246, .15);
    --teal: #14b8a6;
    --teal-glow: rgba(20, 184, 166, .15);
    --amber: #f59e0b;
    --shadow: 0 4px 24px rgba(0, 0, 0, .3);
    --modal-bg: rgba(0, 0, 0, .6);
    --radius: 12px;
    --radius-lg: 16px;
    font-family: 'Inter', -apple-system, sans-serif;
}

/* ── Light Theme ────────────────────────────────────────────────────── */
/* ── Light Theme (Pastel Glassmorphism) ────────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg: #f5f3f0;
    --surface: rgba(255, 255, 255, 0.75);
    --surface-2: rgba(255, 255, 255, 0.9);
    --surface-3: #ffffff;
    --border: rgba(0, 0, 0, 0.05);
    --border-hover: rgba(0, 0, 0, 0.1);
    --text: #111827;
    --text-muted: #4b5563;
    --text-dim: #6b7280;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    
    /* Pastel Accents */
    --brand-glow: #e0e7ff; /* Blue pastel box */
    --brand: #3b82f6; 
    --brand-light: #2563eb;
    
    --orange-glow: #ffedd5; /* Orange pastel box */
    --orange: #ea580c;
    
    --purple-glow: #f3e8ff; /* Purple pastel box */
    --purple: #9333ea;
    
    --green-glow: #dcfce7; /* Green pastel box */
    --green: #16a34a;
    
    --teal-glow: #ccfbf1; /* Alt green pastel box */
    --teal: #0d9488;
    
    --red-glow: #fee2e2; /* Red pastel box */
    --red: #dc2626;
    
    --modal-bg: rgba(255, 255, 255, 0.4);
}

[data-theme="light"] .sidebar {
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 2px 0 8px rgba(0, 0, 0, .04);
}

[data-theme="light"] .panel,
[data-theme="light"] .settings-section,
[data-theme="light"] .kpi-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

[data-theme="light"] {
    background: url('/img/bg-gradient.jpg') center/cover fixed; /* Using an optional background if available, otherwise it falls back to var(--bg) */
}

[data-theme="light"] body {
    background: transparent;
}

[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .panel,
[data-theme="light"] .settings-section,
[data-theme="light"] .kpi-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-lg);
}

[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

[data-theme="light"] .unit-cell {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .unit-cell.occupied {
    background: linear-gradient(135deg, rgba(220, 252, 231, 0.8), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(220, 252, 231, 0.9);
}

[data-theme="light"] .unit-cell.available {
    background: linear-gradient(135deg, rgba(224, 231, 255, 0.8), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(224, 231, 255, 0.9);
}

[data-theme="light"] .unit-cell.reserved {
    background: linear-gradient(135deg, rgba(255, 237, 213, 0.8), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(255, 237, 213, 0.9);
}

[data-theme="light"] .listing-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

[data-theme="light"] .modal-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link.active {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .msg-bubble {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .msg.user .msg-bubble {
    background: var(--brand);
    color: white;
    border: none;
}

/* ── KPI Box Colors (Light Theme) ─────────────────────────────────────────────────── */

[data-theme="light"] .kpi-theme-blue {
    background: linear-gradient(135deg, #e0e7ff 0%, #f1f5f9 100%);
    border: 1px solid #c7d2fe;
    color: #1e3a8a;
}
[data-theme="light"] .kpi-theme-blue .kpi-label { color: #3730a3; }
[data-theme="light"] .kpi-theme-blue .kpi-icon-box { background: rgba(255,255,255,0.6); color: #4f46e5; }
[data-theme="light"] .kpi-theme-blue .kpi-trend { color: #4338ca; }

[data-theme="light"] .kpi-theme-orange {
    background: linear-gradient(135deg, #ffedd5 0%, #fff7ed 100%);
    border: 1px solid #fed7aa;
    color: #7c2d12;
}
[data-theme="light"] .kpi-theme-orange .kpi-label { color: #9a3412; }
[data-theme="light"] .kpi-theme-orange .kpi-icon-box { background: rgba(255,255,255,0.6); color: #ea580c; }
[data-theme="light"] .kpi-theme-orange .kpi-trend { color: #c2410c; }

[data-theme="light"] .kpi-theme-purple {
    background: linear-gradient(135deg, #f3e8ff 0%, #faf5ff 100%);
    border: 1px solid #e9d5ff;
    color: #581c87;
}
[data-theme="light"] .kpi-theme-purple .kpi-label { color: #6b21a8; }
[data-theme="light"] .kpi-theme-purple .kpi-icon-box { background: rgba(255,255,255,0.6); color: #9333ea; }
[data-theme="light"] .kpi-theme-purple .kpi-trend { color: #7e22ce; }

[data-theme="light"] .kpi-theme-green {
    background: linear-gradient(135deg, #dcfce7 0%, #f0fdf4 100%);
    border: 1px solid #bbf7d0;
    color: #14532d;
}
[data-theme="light"] .kpi-theme-green .kpi-label { color: #166534; }
[data-theme="light"] .kpi-theme-green .kpi-icon-box { background: rgba(255,255,255,0.6); color: #16a34a; }
[data-theme="light"] .kpi-theme-green .kpi-trend { color: #15803d; }

[data-theme="light"] .kpi-theme-teal {
    background: linear-gradient(135deg, #ccfbf1 0%, #f0fdfa 100%);
    border: 1px solid #99f6e4;
    color: #134e4a;
}
[data-theme="light"] .kpi-theme-teal .kpi-label { color: #115e59; }
[data-theme="light"] .kpi-theme-teal .kpi-icon-box { background: rgba(255,255,255,0.6); color: #0d9488; }
[data-theme="light"] .kpi-theme-teal .kpi-trend { color: #0f766e; }

[data-theme="light"] .kpi-theme-red {
    background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
    border: 1px solid #fecaca;
    color: #7f1d1d;
}
[data-theme="light"] .kpi-theme-red .kpi-label { color: #991b1b; }
[data-theme="light"] .kpi-theme-red .kpi-icon-box { background: rgba(255,255,255,0.6); color: #dc2626; }
[data-theme="light"] .kpi-theme-red .kpi-trend { color: #b91c1c; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100vh;
    margin: 0;
    padding: 0;
    transition: background .3s, color .3s;
}

/* ── Layout ─────────────────────────────────────────────────────────── */
#app-shell {
    display: flex;
    height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform .3s, background .3s;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
    height: 32px;
    width: auto;
}

.brand-text {
    font-weight: 700;
    font-size: .75rem;
    color: var(--text);
    line-height: 1.2;
}

.brand-sub {
    font-size: .6rem;
    color: var(--brand-light);
    font-weight: 500;
}

.nav-menu {
    flex: 1;
    padding: .5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .7rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .78rem;
    font-weight: 500;
    transition: all .15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .05);
    color: var(--text);
}

[data-theme="light"] .nav-link:hover {
    background: rgba(0, 0, 0, .04);
}

.nav-link.active {
    background: var(--brand-glow);
    color: var(--brand-light);
    border: 1px solid rgba(37, 99, 235, .2);
}

.nav-link i {
    width: 16px;
    text-align: center;
    font-size: .82rem;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: .4rem .5rem;
}

.sidebar-footer {
    padding: .8rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .68rem;
    color: var(--text-dim);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

/* ── Main ───────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    padding: .8rem 1.2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    transition: background .3s;
}

.header-left {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.header-left h1 {
    font-size: 1.15rem;
    font-weight: 700;
}

.header-sub {
    font-size: .72rem;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.header-badge {
    background: var(--brand-glow);
    color: var(--brand-light);
    border: 1px solid rgba(37, 99, 235, .25);
    padding: .25rem .6rem;
    border-radius: 50px;
    font-size: .65rem;
    font-weight: 600;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .7
    }
}

.theme-toggle {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .35rem .6rem;
    cursor: pointer;
    color: var(--text);
    font-size: .85rem;
    transition: all .2s;
}

.theme-toggle:hover {
    border-color: var(--brand);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .75rem;
    color: #fff;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: .78rem;
}

.user-role {
    font-size: .65rem;
    color: var(--text-dim);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
}

.page-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.2rem;
}

.page-container::-webkit-scrollbar {
    width: 5px;
}

.page-container::-webkit-scrollbar-track {
    background: transparent;
}

.page-container::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 10px;
}

/* ── Shared ──────────────────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: border-color .3s, background .3s;
}

.panel:hover {
    border-color: var(--border-hover);
}

.panel-title {
    font-size: .85rem;
    font-weight: 700;
    margin-bottom: .8rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.panel-title i {
    color: var(--brand-light);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    padding: .5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: .78rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--brand);
    color: var(--brand-light);
}

.btn-danger {
    background: var(--red-glow);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, .2);
}

.btn-danger:hover {
    background: var(--red);
    color: #fff;
}

.btn-sm {
    padding: .35rem .7rem;
    font-size: .72rem;
}

.btn-green {
    background: var(--green-glow);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, .2);
}

.btn-green:hover {
    background: var(--green);
    color: #fff;
}

/* ── KPI Cards ──────────────────────────────────────────────────────── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .8rem;
    margin-bottom: 1.2rem;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: .8rem;
    transition: transform .2s, border-color .3s;
    cursor: pointer;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.kpi-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.5), 0 2px 10px rgba(0,0,0,0.05);
}

.kpi-icon.blue {
    background: var(--brand-glow);
    color: var(--brand-light);
}

.kpi-icon.green {
    background: var(--green-glow);
    color: var(--green);
}

.kpi-icon.orange {
    background: var(--orange-glow);
    color: var(--orange);
}

.kpi-icon.purple {
    background: var(--purple-glow);
    color: var(--purple);
}

.kpi-icon.teal {
    background: var(--teal-glow);
    color: var(--teal);
}

.kpi-label {
    font-size: .72rem;
    color: var(--text-muted);
    margin-bottom: .1rem;
}

.kpi-value {
    font-size: 1.3rem;
    font-weight: 800;
}

.kpi-trend {
    font-size: .68rem;
    margin-top: .1rem;
    display: flex;
    align-items: center;
    gap: .2rem;
}

.kpi-trend.up {
    color: var(--green);
}

.kpi-trend.down {
    color: var(--red);
}

/* ── Feed ────────────────────────────────────────────────────────────── */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-height: 350px;
    overflow-y: auto;
}

.feed-item {
    display: flex;
    gap: .6rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--border);
    animation: fadeSlide .3s ease;
}

.feed-item:last-child {
    border-bottom: none;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateX(-6px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

.feed-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
}

.feed-dot.blue {
    background: var(--brand-glow);
    color: var(--brand-light)
}

.feed-dot.green {
    background: var(--green-glow);
    color: var(--green)
}

.feed-dot.orange {
    background: var(--orange-glow);
    color: var(--orange)
}

.feed-dot.amber {
    background: var(--orange-glow);
    color: var(--amber)
}

.feed-dot.red {
    background: var(--red-glow);
    color: var(--red)
}

.feed-dot.purple {
    background: var(--purple-glow);
    color: var(--purple)
}

.feed-dot.teal {
    background: var(--teal-glow);
    color: var(--teal)
}

.feed-agent {
    font-size: .75rem;
    font-weight: 600;
}

.feed-action {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: .05rem;
}

.feed-time {
    font-size: .6rem;
    color: var(--text-dim);
    margin-top: .15rem;
}

/* ── Unit Grid ──────────────────────────────────────────────────────── */
.unit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: .6rem;
}

.unit-cell {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .7rem;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}

.unit-cell:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.unit-cell.occupied {
    border-left: 3px solid var(--green);
}

.unit-cell.available {
    border-left: 3px solid var(--brand-light);
}

.unit-cell.reserved {
    border-left: 3px solid var(--orange);
}

.unit-id {
    font-size: .68rem;
    font-weight: 700;
    color: var(--text-muted);
}

.unit-size {
    font-size: 1rem;
    font-weight: 800;
    margin: .1rem 0;
}

.unit-type {
    font-size: .62rem;
    color: var(--text-dim);
}

.unit-tenant {
    font-size: .68rem;
    color: var(--text-muted);
    margin-top: .3rem;
}

.unit-status-badge {
    position: absolute;
    top: .5rem;
    right: .5rem;
    font-size: .55rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: .12rem .35rem;
    border-radius: 4px;
    letter-spacing: .4px;
}

.unit-status-badge.occupied {
    background: var(--green-glow);
    color: var(--green)
}

.unit-status-badge.available {
    background: var(--brand-glow);
    color: var(--brand-light)
}

.unit-status-badge.reserved {
    background: var(--orange-glow);
    color: var(--orange)
}

/* ── Pipeline ───────────────────────────────────────────────────────── */
.pipeline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .8rem;
}

.pipeline-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: .8rem;
}

.pipeline-header {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: .6rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipeline-header .count {
    background: rgba(255, 255, 255, .06);
    padding: .08rem .4rem;
    border-radius: 10px;
    font-size: .65rem;
}

.pipeline-header.new {
    border-color: var(--brand-light);
    color: var(--brand-light)
}

.pipeline-header.contacted {
    border-color: var(--orange);
    color: var(--orange)
}

.pipeline-header.viewing {
    border-color: var(--purple);
    color: var(--purple)
}

.pipeline-header.signed {
    border-color: var(--green);
    color: var(--green)
}

.lead-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .7rem;
    margin-bottom: .5rem;
    transition: all .2s;
    cursor: pointer;
}

.lead-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.lead-name {
    font-size: .78rem;
    font-weight: 600;
}

.lead-company {
    font-size: .68rem;
    color: var(--text-muted);
}

.lead-interest {
    font-size: .68rem;
    color: var(--brand-light);
    margin-top: .2rem;
}

.lead-source {
    font-size: .6rem;
    color: var(--text-dim);
    margin-top: .2rem;
    display: flex;
    align-items: center;
    gap: .2rem;
}

/* ── Agent Cards ────────────────────────────────────────────────────── */
.agent-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: all .3s;
    cursor: pointer;
}

.agent-card:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
}

.agent-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: .6rem;
}

.agent-icon-box {
    font-size: 1.2rem;
}

.agent-status-pill {
    font-size: .55rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: .15rem .4rem;
    border-radius: 50px;
    letter-spacing: .4px;
}

.agent-status-pill.active {
    background: var(--green-glow);
    color: var(--green)
}

.agent-status-pill.idle {
    background: rgba(255, 255, 255, .04);
    color: var(--text-dim)
}

.agent-title {
    font-size: .85rem;
    font-weight: 700;
    margin-bottom: .15rem;
}

.agent-desc {
    font-size: .72rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

.agent-metric {
    font-size: .68rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: .3rem;
}

.agent-metric i {
    color: var(--brand-light);
}

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-bg);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn .2s;
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: slideUp .25s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.modal-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: .2rem;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.2rem;
}

.modal-footer {
    padding: .8rem 1.2rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
}

.modal .form-group {
    margin-bottom: .8rem;
}

.modal label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: .3rem;
}

.modal input,
.modal select,
.modal textarea {
    width: 100%;
    padding: .5rem .7rem;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: .8rem;
    outline: none;
    transition: border-color .2s;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
    border-color: var(--brand);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
    font-weight: 500;
}

.detail-value {
    font-weight: 600;
}

/* ── Chat ────────────────────────────────────────────────────────────── */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand), var(--purple));
}

.chat-header {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.chat-header-left i {
    color: var(--brand-light);
    font-size: 1rem;
}

.chat-header-left h2 {
    font-size: .9rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .8rem;
}

.msg {
    display: flex;
    gap: .5rem;
    max-width: 82%;
    animation: fadeSlide .3s ease;
}

.msg.ai {
    align-self: flex-start;
}

.msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
}

.msg.ai .msg-avatar {
    background: var(--brand-glow);
    color: var(--brand-light);
    border: 1px solid rgba(37, 99, 235, .2);
}

.msg.user .msg-avatar {
    background: linear-gradient(135deg, var(--brand), var(--purple));
    color: #fff;
}

.msg-bubble {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: .6rem .9rem;
    border-radius: var(--radius);
    font-size: .8rem;
    line-height: 1.6;
}

.msg.ai .msg-bubble {
    border-top-left-radius: 2px;
}

.msg.user .msg-bubble {
    border-top-right-radius: 2px;
    background: var(--brand-glow);
    border-color: rgba(37, 99, 235, .2);
}

.msg-bubble strong {
    color: var(--text);
}

.msg-bubble ul,
.msg-bubble ol {
    margin: .2rem 0 .2rem 1rem;
}

.msg-bubble li {
    margin-bottom: .15rem;
}

/* Markdown tables in chat */
.msg-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: .5rem 0;
    font-size: .75rem;
}

.msg-bubble th,
.msg-bubble td {
    border: 1px solid var(--border);
    padding: .35rem .5rem;
    text-align: left;
}

.msg-bubble th {
    background: var(--surface-3, rgba(255, 255, 255, .04));
    font-weight: 700;
    color: var(--text);
}

.msg-bubble td {
    color: var(--text-muted);
}

.msg-bubble tr:hover td {
    background: rgba(255, 255, 255, .02);
}

/* Code blocks */
.msg-bubble pre {
    background: var(--surface-3, rgba(0, 0, 0, .3));
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .6rem;
    overflow-x: auto;
    margin: .4rem 0;
    font-size: .72rem;
}

.msg-bubble code {
    background: rgba(255, 255, 255, .06);
    padding: .1rem .3rem;
    border-radius: 3px;
    font-size: .72rem;
    font-family: 'Courier New', monospace;
}

.msg-bubble pre code {
    background: none;
    padding: 0;
}

/* Horizontal rules */
.msg-bubble hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: .6rem 0;
}

/* Blockquotes */
.msg-bubble blockquote {
    border-left: 3px solid var(--brand);
    padding-left: .6rem;
    margin: .4rem 0;
    color: var(--text-muted);
    font-style: italic;
}

/* Headings */
.msg-bubble h1,
.msg-bubble h2,
.msg-bubble h3,
.msg-bubble h4 {
    margin: .5rem 0 .3rem;
    color: var(--text);
}

.msg-bubble h1 {
    font-size: 1rem;
}

.msg-bubble h2 {
    font-size: .9rem;
}

.msg-bubble h3 {
    font-size: .82rem;
}

.msg-bubble h4 {
    font-size: .78rem;
}

/* Paragraphs */
.msg-bubble p {
    margin: .3rem 0;
}

.msg-bubble p:first-child {
    margin-top: 0;
}

.msg-bubble p:last-child {
    margin-bottom: 0;
}

.chat-input-row {
    padding: .8rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: .4rem;
}

.chat-input-row input {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .6rem .8rem;
    color: var(--text);
    font-family: inherit;
    font-size: .8rem;
    outline: none;
}

.chat-input-row input:focus {
    border-color: var(--brand);
}

.chat-input-row button {
    background: var(--brand);
    color: #fff;
    border: none;
    width: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-input-row button:hover {
    background: var(--brand-dark);
}

.typing-indicator {
    display: flex;
    gap: 3px;
    padding: .4rem 0;
}

.typing-indicator span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-dim);
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: .2s
}

.typing-indicator span:nth-child(3) {
    animation-delay: .4s
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0)
    }

    30% {
        transform: translateY(-5px)
    }
}

/* ── Marketing ──────────────────────────────────────────────────────── */
.gen-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    margin-bottom: 1rem;
}

.gen-tabs {
    display: flex;
    gap: .4rem;
    margin-bottom: .8rem;
    flex-wrap: wrap;
}

.gen-tab {
    padding: .4rem .8rem;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 500;
    transition: all .2s;
    font-family: inherit;
}

.gen-tab:hover {
    border-color: var(--brand);
    color: var(--text);
}

.gen-tab.active {
    background: var(--brand-glow);
    border-color: var(--brand);
    color: var(--brand-light);
}

.gen-textarea {
    width: 100%;
    min-height: 70px;
    padding: .7rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: .8rem;
    resize: vertical;
    outline: none;
}

.gen-textarea:focus {
    border-color: var(--brand);
}

.gen-output {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    white-space: pre-wrap;
    font-size: .8rem;
    line-height: 1.7;
    color: var(--text-muted);
    min-height: 180px;
}

.gen-output .placeholder {
    color: var(--text-dim);
    font-style: italic;
}

/* ── Image Gallery ──────────────────────────────────────────────────── */
.img-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .6rem;
}

.img-card {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all .2s;
    position: relative;
}

.img-card:hover {
    border-color: var(--brand);
    transform: scale(1.02);
}

.img-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.img-card .img-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}

.img-card:hover .img-overlay {
    opacity: 1;
}

.img-overlay i {
    color: #fff;
    font-size: 1.2rem;
}

/* ── Monitoring ─────────────────────────────────────────────────────── */
.listing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all .2s;
}

.listing-card:hover {
    border-color: var(--border-hover);
}

.listing-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--brand-glow);
    color: var(--brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.listing-meta {
    flex: 1;
}

.listing-platform {
    font-size: .82rem;
    font-weight: 700;
}

.listing-stats {
    font-size: .68rem;
    color: var(--text-muted);
    margin-top: .2rem;
}

.listing-status {
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: .15rem .4rem;
    border-radius: 4px;
}

.listing-status.active {
    background: var(--green-glow);
    color: var(--green);
}

.listing-status.paused {
    background: var(--orange-glow);
    color: var(--orange);
}

.listing-status.pending {
    background: var(--purple-glow);
    color: var(--purple);
}

/* ── Settings ───────────────────────────────────────────────────────── */
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.settings-section h3 {
    font-size: .85rem;
    font-weight: 700;
    margin-bottom: .6rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.settings-section h3 i {
    color: var(--brand-light);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: .78rem;
}

.setting-value {
    font-size: .75rem;
    color: var(--brand-light);
    font-weight: 600;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: var(--surface-3);
    position: relative;
    cursor: pointer;
    transition: background .2s;
}

.toggle-switch.on {
    background: var(--brand);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: left .2s;
}

.toggle-switch.on::after {
    left: 18px;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media(max-width:1024px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr)
    }

    .pipeline {
        grid-template-columns: repeat(2, 1fr)
    }

    .grid-3 {
        grid-template-columns: 1fr 1fr
    }
}

@media(max-width:768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%)
    }

    .sidebar.open {
        transform: translateX(0)
    }

    .menu-toggle {
        display: block
    }

    .kpi-row {
        grid-template-columns: 1fr
    }

    .pipeline {
        grid-template-columns: 1fr
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr
    }
}

/* ── Btn Outline ──────────────────────────────────────────────────────── */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--brand-light);
    background: var(--brand-glow);
    color: var(--brand-light);
}

/* ── Btn Danger ───────────────────────────────────────────────────────── */
.btn-danger {
    background: var(--red);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
    filter: brightness(1.1);
}

/* ── Btn Green ────────────────────────────────────────────────────────── */
.btn-green {
    background: var(--green);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-green:hover {
    filter: brightness(1.1);
}

/* ── Toggle Switch ────────────────────────────────────────────────────── */
.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--surface-3);
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-switch.on {
    background: var(--green);
}

.toggle-switch.on::after {
    transform: translateX(16px);
}

/* ── Fade-in Animation ───────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}