/* Villa Rent — Modern Indigo + Slate Theme */

/* Local Vazirmatn font (no CDN dependency) */
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/vazirmatn.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Brand colors */
    --accent-h: 243;
    --accent-s: 75%;
    --accent-l: 60%;

    /* Surfaces — Slate palette */
    --bg: 210 40% 98%;                /* #F8FAFC — slate-50 background */
    --fg: 215 28% 17%;                /* #1E293B — slate-800 text */
    --card: 0 0% 100%;                /* #FFFFFF — pure white cards */
    --border: 214 32% 91%;            /* #E2E8F0 — slate-200 borders */
    --muted: 210 40% 96%;             /* #F1F5F9 — slate-100 muted */
    --muted-fg: 215 16% 47%;          /* #64748B — slate-500 muted text */
    --primary: var(--accent-h) var(--accent-s) var(--accent-l);  /* #6366F1 — indigo */
    --primary-fg: 0 0% 100%;          /* white on indigo */
    --sidebar: 222 47% 11%;           /* #0F172A — slate-900 sidebar */
    --emerald: 142 71% 45%;           /* #22C55E — green */
    --emerald-fg: 0 0% 100%;

    /* ============================================================
       SALES INTELLIGENCE DASHBOARD — SI accent palette
       (used as accents on top of the indigo/slate base)
       ============================================================ */
    --si-won: #22C55E;
    --si-lost: #EF4444;
    --si-progress: #3B82F6;
    --si-blocked: #F59E0B;
    --si-quota-met: #EAB308;
    --si-quota-missed: #94A3B8;
    --si-gauge-track: #E2E8F0;
    --si-gauge-fill: #6366F1;
    --si-rank-1: #EAB308;
    --si-rank-2: #94A3B8;
    --si-rank-3: #B45309;
    --si-pipeline-1: #3B82F6;
    --si-pipeline-2: #6366F1;
    --si-pipeline-3: #8B5CF6;
    --si-pipeline-4: #22C55E;
}

* {
    border-color: hsl(var(--border));
}

/* === Image Gallery Slider (absolute positioning — RTL-safe) === */

/* Prevent horizontal scroll caused by off-screen elements (negative margins, decorations, etc.) */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}
body {
    background-color: hsl(var(--bg));
    color: hsl(var(--fg));
    font-family: 'Vazirmatn', 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Improve text rendering on mobile */
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

/* Latin / numeric content should render LTR even in RTL containers */
.ltr-numbers {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
}

/* Indigo accent glow (subtle) */
.crm-glow {
    box-shadow: 0 4px 20px -4px hsl(var(--primary) / 0.35);
}

/* Card hover effect */
.crm-card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.crm-card-hover:hover {
    transform: translateY(-2px);
    border-color: hsl(var(--primary) / 0.4);
    box-shadow: 0 12px 32px -8px hsl(var(--primary) / 0.18);
}

/* Fade up animation */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up {
    animation: fadeUp 0.4s ease-out;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: hsl(var(--bg));
}
::-webkit-scrollbar-thumb {
    background: hsl(214 32% 75%);
    border-radius: 6px;
    border: 2px solid hsl(var(--bg));
}
::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--primary) / 0.6);
}

/* Status badges */
.status-active { background: hsl(142 50% 92%); color: hsl(142 50% 30%); }
.status-maintenance { background: #FEF3C7; color: #92400E; }
.status-inactive { background: hsl(0 0% 92%); color: hsl(0 0% 40%); }
.status-booked { background: hsl(217 80% 92%); color: hsl(217 70% 35%); }

/* Input autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: hsl(var(--fg));
    -webkit-box-shadow: 0 0 0 1000px hsl(var(--card)) inset;
    transition: background-color 9999s ease-in-out 0s;
}

/* Range slider (LTR direction) */
input[type="range"] {
    direction: ltr;
}

/* Hide number input spinners */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Hide scrollbar for nav on mobile (still scrollable) */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* === Image Gallery Slider (absolute positioning — RTL-safe) === */
.gallery {
    position: relative;
    overflow: hidden;
    background: #E2E8F0;
    width: 100%;
    height: 320px;
}
@media (min-width: 640px) {
    .gallery { height: 420px; }
}
.gallery-slides {
    position: relative;
    width: 100%;
    height: 100%;
}
.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
    z-index: 1;
}
.gallery-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}
.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1E293B;
    transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 200ms var(--ease-out);
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.gallery-btn:hover {
    background: #6366F1;
    color: white;
    transform: translateY(-50%) scale(1.1);
}
.gallery-btn-prev { right: 12px; }
.gallery-btn-next { left: 12px; }
.gallery-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}
.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.6);
    border: none;
    cursor: pointer;
    transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 200ms var(--ease-out);
    padding: 0;
}
.gallery-dot.active {
    background: #6366F1;
    width: 24px;
    border-radius: 4px;
}
.gallery-counter {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.65);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    z-index: 10;
    font-family: 'Vazirmatn', sans-serif;
}

/* Luxury heading underline */
.luxury-divider {
    position: relative;
    padding-bottom: 12px;
}
.luxury-divider::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 2px;
    background: hsl(var(--primary));
}

/* === Collapsible villa list (dropdown) === */
.villa-list-collapsed {
    display: none !important;
}
.villa-toggle-icon {
    transition: transform 0.2s ease;
}
.villa-toggle-icon.expanded {
    transform: rotate(180deg);
}

/* ============================================================
   EMIL KOWALSKI ANIMATION PRINCIPLES
   Custom easing curves, press feedback, reduced-motion, hover gates
   ============================================================ */

/* Strong custom easing curves (never use built-in CSS easings) */
:root {
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);       /* Snappy enter */
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);   /* Natural movement */
    --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);    /* iOS-like drawer */
}

/* Button press feedback — all clickable elements feel responsive */
button:active:not(:disabled),
a:active:not(.no-press),
[type="submit"]:active:not(:disabled),
[type="button"]:active:not(:disabled) {
    transform: scale(0.97);
    transition: transform 100ms var(--ease-out);
}

/* Restore transform on release */
button:not(:disabled),
a:not(.no-press),
[type="submit"]:not(:disabled),
[type="button"]:not(:disabled) {
    transition: transform 160ms var(--ease-out), background-color 200ms var(--ease-out), border-color 200ms var(--ease-out), opacity 200ms var(--ease-out);
}

/* Stagger animation for list items */
@keyframes stagger-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.stagger-item {
    opacity: 0;
    animation: stagger-in 300ms var(--ease-out) forwards;
}
.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 40ms; }
.stagger-item:nth-child(3) { animation-delay: 80ms; }
.stagger-item:nth-child(4) { animation-delay: 120ms; }
.stagger-item:nth-child(5) { animation-delay: 160ms; }
.stagger-item:nth-child(6) { animation-delay: 200ms; }
.stagger-item:nth-child(7) { animation-delay: 240ms; }
.stagger-item:nth-child(8) { animation-delay: 280ms; }
.stagger-item:nth-child(9) { animation-delay: 320ms; }
.stagger-item:nth-child(10) { animation-delay: 360ms; }
/* For items beyond 10, use a cap */
.stagger-item:nth-child(n+11) { animation-delay: 400ms; }

/* Card enter animation (scale from 0.95, not 0) */
@keyframes card-enter {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.card-enter {
    animation: card-enter 200ms var(--ease-out);
}

/* Modal enter — scale from 0.95 with opacity (not scale 0) */
@keyframes modal-enter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.modal-enter {
    animation: modal-enter 200ms var(--ease-out);
}

/* Toast/notification enter from top */
@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.toast-enter {
    animation: toast-enter 200ms var(--ease-out);
}

/* Villa card reveal — scale + fade in */
@keyframes villa-reveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.villa-reveal {
    animation: villa-reveal 250ms var(--ease-out);
}

/* Hover gate — only apply hover effects on devices with fine pointer (not touch) */
@media (hover: hover) and (pointer: fine) {
    .hover-lift {
        transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
    }
    .hover-lift:hover {
        transform: translateY(-2px);
    }
}

/* Reduced motion — keep opacity/color transitions, remove movement */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .stagger-item,
    .card-enter,
    .modal-enter,
    .toast-enter,
    .villa-reveal {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    button:active:not(:disabled),
    a:active:not(.no-press) {
        transform: none !important;
    }
}

/* ============================================================
   SALES INTELLIGENCE DASHBOARD — SI utility classes
   Accent layer on top of the existing indigo/slate base
   ============================================================ */

/* Status border (deal-card style) — colored left border in RTL flips to right */
.si-status-border {
    border-right: 3px solid var(--si-progress);
    border-left: 1px solid hsl(var(--border));
}
.si-status-won      { border-right-color: var(--si-won); }
.si-status-lost     { border-right-color: var(--si-lost); }
.si-status-progress { border-right-color: var(--si-progress); }
.si-status-blocked  { border-right-color: var(--si-blocked); }
.si-status-quota    { border-right-color: var(--si-quota-met); }
.si-status-missed   { border-right-color: var(--si-quota-missed); }

/* SI metric card — flat + minimalism with soft hover (Soft UI evolution) */
.si-metric-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.si-metric-card:hover {
    border-color: #6366F1;
    box-shadow: 0 6px 20px -8px rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

/* SI metric label + value typography */
.si-metric-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #64748B;
    text-transform: uppercase;
}
.si-metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #1E293B;
    line-height: 1.2;
    margin-top: 4px;
}
.si-metric-delta {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.si-delta-up   { color: #065F46; }
.si-delta-down { color: #991B1B; }

/* Status badge variants — SI palette */
.si-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.si-badge-won      { background: #D1FAE5; color: #065F46; }
.si-badge-lost     { background: #FEE2E2; color: #991B1B; }
.si-badge-progress { background: #DBEAFE; color: #1E40AF; }
.si-badge-blocked  { background: #FEF3C7; color: #92400E; }
.si-badge-quota    { background: #FEF9C3; color: #854D0E; }
.si-badge-missed   { background: #F1F5F9; color: #475569; }

/* Pipeline / Funnel — horizontal flex columns with gradient stages */
.si-funnel {
    display: flex;
    gap: 4px;
    width: 100%;
    align-items: stretch;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #E2E8F0;
}
.si-funnel-stage {
    flex: 1 1 0;
    padding: 10px 8px;
    background: linear-gradient(180deg, var(--stage-color, #6366F1) 0%, color-mix(in srgb, var(--stage-color, #6366F1) 80%, #fff) 100%);
    color: #fff;
    text-align: center;
    transition: filter 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.si-funnel-stage:hover { filter: brightness(1.08); transform: translateY(-1px); }
.si-funnel-stage .si-funnel-count { font-size: 18px; font-weight: 700; display: block; }
.si-funnel-stage .si-funnel-label { font-size: 11px; opacity: 0.92; display: block; margin-top: 2px; }

/* Vertical funnel (downward) */
.si-funnel-vertical { flex-direction: column; gap: 6px; }
.si-funnel-vertical .si-funnel-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: right;
    padding: 8px 12px;
    border-radius: 6px;
}

/* SVG Gauge chart — arc style */
.si-gauge { display: block; width: 100%; max-width: 140px; margin: 0 auto; }
.si-gauge-track { stroke: var(--si-gauge-track); fill: none; stroke-linecap: round; }
.si-gauge-fill  { stroke: var(--si-gauge-fill, #6366F1); fill: none; stroke-linecap: round; transition: stroke-dashoffset 600ms var(--ease-out); }
.si-gauge-fill.si-fill-won      { stroke: var(--si-won); }
.si-gauge-fill.si-fill-progress { stroke: var(--si-progress); }
.si-gauge-fill.si-fill-blocked  { stroke: var(--si-blocked); }
.si-gauge-fill.si-fill-quota    { stroke: var(--si-quota-met); }
.si-gauge-fill.si-fill-missed   { stroke: var(--si-quota-missed); }
.si-gauge-needle { stroke: #1E293B; stroke-width: 2; stroke-linecap: round; transition: transform 600ms var(--ease-out); transform-origin: 50% 80%; }
.si-gauge-label { font-size: 11px; fill: #64748B; text-anchor: middle; font-family: inherit; }
.si-gauge-value { font-size: 22px; font-weight: 700; fill: #1E293B; text-anchor: middle; }

/* Timeline (vertical) — recent activity feed */
.si-timeline { position: relative; padding-inline-start: 18px; }
.si-timeline::before {
    content: '';
    position: absolute;
    inset-block: 4px;
    inset-inline-start: 6px;
    width: 2px;
    background: linear-gradient(180deg, #E2E8F0 0%, #E2E8F0 100%);
    border-radius: 2px;
}
.si-timeline-item { position: relative; padding: 6px 0 10px 4px; }
.si-timeline-item::before {
    content: '';
    position: absolute;
    inset-inline-start: -16px;
    top: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--node-color, #6366F1);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--node-color, #6366F1) 30%, transparent);
}
.si-timeline-node-won      { --node-color: var(--si-won); }
.si-timeline-node-lost     { --node-color: var(--si-lost); }
.si-timeline-node-progress { --node-color: var(--si-progress); }
.si-timeline-node-blocked  { --node-color: var(--si-blocked); }
.si-timeline-node-quota    { --node-color: var(--si-quota-met); }
.si-timeline-node-muted    { --node-color: var(--si-quota-missed); }

/* Leaderboard ranking styles */
.si-leader-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background-color 200ms var(--ease-out);
}
.si-leader-row:hover { background: #F8FAFC; }
.si-rank {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    background: #F1F5F9;
    color: #475569;
}
.si-rank-1 { background: var(--si-rank-1); color: #fff; box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.18); }
.si-rank-2 { background: var(--si-rank-2); color: #fff; box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.18); }
.si-rank-3 { background: var(--si-rank-3); color: #fff; box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.18); }

/* Segmented control — used for filter buttons (kanban-style) */
.si-segmented {
    display: inline-flex;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}
.si-segmented::-webkit-scrollbar { display: none; }
.si-segmented-item {
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #64748B;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
    white-space: nowrap;
    flex-shrink: 0;
}
.si-segmented-item:hover { color: #1E293B; }
.si-segmented-item.is-active {
    background: #fff;
    color: #6366F1;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

/* Kanban column (flex) — used in villa browse + cart */
.si-kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.si-kanban-col {
    flex: 0 0 300px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.si-kanban-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--col-color, #6366F1);
    font-weight: 700;
    font-size: 13px;
    color: #1E293B;
}
.si-kanban-col-count {
    background: color-mix(in srgb, var(--col-color, #6366F1) 18%, #fff);
    color: var(--col-color, #6366F1);
    padding: 1px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
}

/* Deal card (cart villa card) — flat with status border */
.si-deal-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.si-deal-card:hover {
    box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.18);
    transform: translateY(-2px);
}

/* Contact card list (CRM) — avatar + meta */
.si-contact-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.si-contact-card:hover {
    border-color: #6366F1;
    box-shadow: 0 4px 14px -6px rgba(99, 102, 241, 0.18);
}
.si-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1, #818CF8);
    color: #fff;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.si-avatar.si-avatar-green  { background: linear-gradient(135deg, #22C55E, #4ADE80); }
.si-avatar.si-avatar-blue   { background: linear-gradient(135deg, #3B82F6, #60A5FA); }
.si-avatar.si-avatar-orange { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
.si-avatar.si-avatar-red    { background: linear-gradient(135deg, #EF4444, #F87171); }
.si-avatar.si-avatar-grey   { background: linear-gradient(135deg, #64748B, #94A3B8); }
.si-avatar.si-avatar-gold   { background: linear-gradient(135deg, #EAB308, #FACC15); }

/* SI focus ring — used on auth inputs */
.si-input {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    color: #1E293B;
    transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.si-input:focus {
    outline: none;
    border-color: #6366F1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* SI panel — generic info container */
.si-panel {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 16px;
}
.si-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #E2E8F0;
}
.si-panel-title { font-size: 14px; font-weight: 700; color: #1E293B; }

/* SI auth card — login/register */
.si-auth-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 10px 40px -12px rgba(15, 23, 42, 0.18);
}
.si-auth-brand {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin: 0 auto 14px;
    background: linear-gradient(135deg, #6366F1 0%, #818CF8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px -8px rgba(99, 102, 241, 0.55);
}

/* SI progress bar (quota / gauge alternative) */
.si-progress-track {
    height: 8px;
    background: #E2E8F0;
    border-radius: 9999px;
    overflow: hidden;
}
.si-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--si-progress), #6366F1);
    border-radius: 9999px;
    transition: width 600ms var(--ease-out);
}
.si-progress-fill.si-fill-won     { background: linear-gradient(90deg, var(--si-won), #4ADE80); }
.si-progress-fill.si-fill-blocked { background: linear-gradient(90deg, var(--si-blocked), #FBBF24); }
.si-progress-fill.si-fill-quota   { background: linear-gradient(90deg, var(--si-quota-met), #FACC15); }
.si-progress-fill.si-fill-missed  { background: linear-gradient(90deg, var(--si-quota-missed), #CBD5E1); }

/* SI status dot (inline presence indicator for chat) */
.si-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--si-quota-missed);
    flex-shrink: 0;
}
.si-dot.si-dot-online   { background: var(--si-won); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.si-dot.si-dot-away     { background: var(--si-blocked); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.si-dot.si-dot-busy     { background: var(--si-lost); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }
.si-dot.si-dot-pending  { background: var(--si-progress); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }

/* SI status highlight (deals that change state get a brief glow) */
@keyframes si-status-pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--si-progress) 50%, transparent); }
    100% { box-shadow: 0 0 0 8px transparent; }
}
.si-status-highlight { animation: si-status-pulse 1.4s ease-out 1; }

/* SI loading gauge (waiting screen) */
@keyframes si-gauge-spin {
    to { transform: rotate(360deg); }
}
.si-gauge-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 4px solid #E2E8F0;
    border-top-color: #6366F1;
    animation: si-gauge-spin 0.8s linear infinite;
}

/* Reduced motion: disable SI-only animations too */
@media (prefers-reduced-motion: reduce) {
    .si-status-highlight { animation: none !important; }
    .si-gauge-spinner { animation: none !important; }
}

/* ============================================================
   SALES INTELLIGENCE DASHBOARD — Utility Classes
   Based on ui-ux-pro-max-skill "Sales Intelligence Dashboard" spec
   ============================================================ */

:root {
    --si-won: #22C55E;
    --si-lost: #EF4444;
    --si-progress: #3B82F6;
    --si-blocked: #F59E0B;
    --si-quota-met: #EAB308;
    --si-quota-missed: #94A3B8;
    --si-gauge-track: #E2E8F0;
    --si-gauge-fill: #6366F1;
    --si-rank-1: #EAB308;
    --si-rank-2: #94A3B8;
    --si-rank-3: #B45309;
}

/* Status border (deal card style — left border colored by status) */
.si-status-border {
    border-left: 3px solid var(--si-progress);
    transition: border-color 200ms var(--ease-out);
}
.si-status-won { border-left-color: var(--si-won); }
.si-status-lost { border-left-color: var(--si-lost); }
.si-status-blocked { border-left-color: var(--si-blocked); }
.si-status-pending { border-left-color: var(--si-progress); }
.si-status-missed { border-left-color: var(--si-quota-missed); }

/* Metric card (Soft UI Evolution — subtle shadow + hover) */
.si-metric-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 16px;
    transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.si-metric-card:hover {
    border-color: #6366F1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

/* Status badge variants */
.si-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.si-badge-won { background: #D1FAE5; color: #065F46; }
.si-badge-lost { background: #FEE2E2; color: #991B1B; }
.si-badge-progress { background: #DBEAFE; color: #1E40AF; }
.si-badge-blocked { background: #FEF3C7; color: #92400E; }
.si-badge-quota { background: #FEF9C3; color: #854D0E; }
.si-badge-missed { background: #F1F5F9; color: #475569; }

/* Pipeline funnel segment */
.si-funnel-segment {
    transition: width 300ms var(--ease-out), opacity 200ms var(--ease-out);
}
.si-funnel-segment:hover { opacity: 0.85; }

/* Gauge (SVG arc) */
.si-gauge { position: relative; width: 80px; height: 80px; }
.si-gauge svg { transform: rotate(-90deg); }
.si-gauge-track-circle { fill: none; stroke: var(--si-gauge-track); stroke-width: 8; }
.si-gauge-fill-circle {
    fill: none; stroke-width: 8; stroke-linecap: round;
    transition: stroke-dashoffset 600ms var(--ease-out);
}
.si-gauge-text {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px; font-weight: 700;
}

/* Timeline */
.si-timeline-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.si-timeline-line { width: 2px; background: #E2E8F0; flex-shrink: 0; margin-right: 19px; }

/* Leaderboard rank badge */
.si-rank-badge {
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.si-rank-1-badge { background: var(--si-rank-1); }
.si-rank-2-badge { background: var(--si-rank-2); }
.si-rank-3-badge { background: var(--si-rank-3); }
.si-rank-default { background: #CBD5E1; }

/* Kanban column */
.si-kanban-col {
    min-height: 80px;
    transition: background-color 200ms var(--ease-out);
}
.si-kanban-col:hover { background-color: #F8FAFC; }

/* Deal card (status border + hover) */
.si-deal-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-left: 3px solid var(--si-progress);
    border-radius: 8px;
    padding: 12px;
    transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.si-deal-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.si-deal-card.si-status-won { border-left-color: var(--si-won); }
.si-deal-card.si-status-lost { border-left-color: var(--si-lost); }
.si-deal-card.si-status-blocked { border-left-color: var(--si-blocked); }
.si-deal-card.si-status-pending { border-left-color: var(--si-progress); }

/* Segmented control (filter buttons) */
.si-segmented {
    display: inline-flex;
    background: #F1F5F9;
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}
.si-segmented-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #64748B;
    transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
    border: none;
    background: transparent;
    cursor: pointer;
}
.si-segmented-btn:hover { color: #1E293B; }
.si-segmented-btn.active {
    background: #fff;
    color: #6366F1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ===========================================================
   Consultant Badge Chips — compact emoji icon with hover tooltip
   Responsive: icon-only on small screens, icon+label on >=sm
   =========================================================== */
.crm-badge-row {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    vertical-align: middle;
    line-height: 1;
}
.crm-badge-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--bb-bg);
    color: var(--bb-color);
    border: 1.5px solid var(--bb-ring);
    border-radius: 9999px;
    cursor: help;
    user-select: none;
    text-decoration: none;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: box-shadow 160ms var(--ease-out, cubic-bezier(0.2, 0.8, 0.2, 1)),
                background-color 160ms ease,
                border-color 160ms ease;
    will-change: box-shadow;
}
.crm-badge-chip:hover,
.crm-badge-chip:focus {
    box-shadow: 0 6px 16px -4px var(--bb-ring);
    background-color: #fff;
    border-width: 2px;
    outline: none;
}
.crm-badge-chip:active { box-shadow: 0 2px 6px -2px var(--bb-ring); }
.crm-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
    top: 1px;
    margin-top: 1px;
}
.crm-badge-label { display: none; line-height: 1; }

/* Size variants — mobile shows icon-only */
.crm-badge-xs .crm-badge-chip { padding: 2px 6px; font-size: 9px; }
.crm-badge-xs .crm-badge-icon { font-size: 13px; }

.crm-badge-sm .crm-badge-chip { padding: 3px 8px; font-size: 10px; }
.crm-badge-sm .crm-badge-icon { font-size: 15px; }

.crm-badge-md .crm-badge-chip { padding: 4px 10px; font-size: 11px; }
.crm-badge-md .crm-badge-icon { font-size: 17px; }

/* On >= sm screens, show label too */
@media (min-width: 640px) {
    .crm-badge-row .crm-badge-label { display: inline; }
    .crm-badge-xs .crm-badge-chip { padding: 2px 8px; }
    .crm-badge-sm .crm-badge-chip { padding: 3px 10px; }
    .crm-badge-md .crm-badge-chip { padding: 4px 12px; }
}

/* Tooltip — pure CSS, no JS */
.crm-badge-chip::before,
.crm-badge-chip::after {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
    z-index: 60;
}
.crm-badge-chip::after {
    content: attr(data-tooltip);
    background: #0F172A;
    color: #F8FAFC;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.55;
    width: max-content;
    max-width: 240px;
    text-align: center;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.35);
    white-space: normal;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.crm-badge-chip::before {
    content: '';
    width: 0; height: 0;
    border: 5px solid transparent;
    border-top-color: #0F172A;
    bottom: calc(100% + 3px);
}
.crm-badge-chip:hover::after,
.crm-badge-chip:hover::before,
.crm-badge-chip:focus::after,
.crm-badge-chip:focus::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip alignment fix when chip is near screen edge */
.crm-badge-row:last-child .crm-badge-chip:last-child::after,
.crm-badge-chip.is-edge::after {
    left: auto;
    right: 0;
    transform: translateY(4px);
}
.crm-badge-row:last-child .crm-badge-chip:last-child:hover::after,
.crm-badge-chip.is-edge:hover::after {
    transform: translateY(0);
}
.crm-badge-row:last-child .crm-badge-chip:last-child::before,
.crm-badge-chip.is-edge::before {
    left: auto;
    right: 8px;
    transform: translateY(4px);
}

/* Touch devices: tooltip can be toggled by tap */
@media (hover: none) {
    .crm-badge-chip { cursor: pointer; }
    .crm-badge-chip:focus::after,
    .crm-badge-chip:focus::before {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .crm-badge-chip,
    .crm-badge-chip::before,
    .crm-badge-chip::after {
        transition: opacity 120ms ease;
        transform: none;
    }
    .crm-badge-chip:hover { transform: none; }
}

