/* =====================================================================
   Violet theme — layout & component skin
   Loaded last. Colours come from the tokens in style.css; this file
   reshapes the shell (floating violet sidebar, soft rounded cards) and
   holds the dashboard components, with tablet and phone layouts.
   ===================================================================== */

body {
    background: var(--canvas);
    font-size: 13.5px;
    letter-spacing: -0.003em;
}
h1 { font-weight: 700; letter-spacing: -0.02em; }
h2, h3, h4 { font-weight: 600; }
h3 { font-size: 15.5px; }

/* ---------- Sidebar: floating violet panel ---------- */
#sidebar {
    top: 16px;
    bottom: 16px;
    left: 16px;
    width: calc(var(--sidebar-w) - 32px);
    background: linear-gradient(180deg, #7b6de4 0%, #6c5dd3 45%, #5d4ec6 100%);
    border: none;
    border-radius: var(--r-xl);
    box-shadow: 0 24px 50px -20px rgba(76, 60, 190, 0.65);
    color: #fff;
    overflow: hidden;
}
#sidebar .brand {
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    height: auto;
    padding: 20px 20px 18px;
}
.sidebar-logo {
    width: 40px;
    height: 40px;
    padding: 6px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 18px -8px rgba(30, 20, 90, 0.6);
}
.brand-name { color: #fff; font-weight: 700; }
.brand-sub { color: rgba(255, 255, 255, 0.62); font-weight: 500; }

#sidebar > nav { padding: 6px 14px 16px; scrollbar-width: none; }
#sidebar > nav::-webkit-scrollbar { display: none; }
.nav-group-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 18px 12px 8px;
}
#sidebar ul li { margin-bottom: 3px; }
#sidebar ul li a.nav-link {
    color: rgba(255, 255, 255, 0.78);
    font-weight: 500;
    font-size: 13.5px;
    padding: 9px 12px;
    border-radius: 14px;
}
#sidebar ul li a.nav-link .ic { color: rgba(255, 255, 255, 0.72); }
#sidebar ul li a.nav-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
#sidebar ul li a.nav-link:hover .ic { color: #fff; }
#sidebar ul li a.nav-link.active {
    background: rgba(48, 34, 140, 0.42);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 10px 20px -12px rgba(20, 10, 80, 0.7);
}
#sidebar ul li a.nav-link.active .ic { color: #fff; }
#sidebar ul li a.nav-link.active::before { display: none; }
#sidebar ul li a.nav-link.danger-link, #sidebar ul li a.nav-link.danger-link .ic { color: #ffd1de; }
.nav-pip { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); }

/* ---------- Sidebar lamp (js/nav-lamp.js) ----------
   A glowing bar on the panel's left edge shines a cone of light across the
   active link and slides to the next one when the section changes. */
#sidebar > nav.has-lamp { position: relative; }
#sidebar > nav.has-lamp ul { position: relative; z-index: 1; }
#sidebar > nav.has-lamp ul li a.nav-link.active { background: transparent; box-shadow: none; }
#sidebar > nav.has-lamp ul li a.nav-link .ic { transition: color 0.3s, filter 0.3s; }
#sidebar > nav.has-lamp ul li a.nav-link.active .ic { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.85)); }
.nav-lamp {
    --lamp-ease: cubic-bezier(0.65, 0, 0.35, 1);
    position: absolute;
    top: 0;
    left: 0;
    width: calc(var(--lamp-x, 14px) + var(--lamp-w, 0px));
    height: var(--lamp-h, 40px);
    transform: translateY(var(--lamp-y, 0px));
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: transform 0.45s var(--lamp-ease), height 0.45s var(--lamp-ease), opacity 0.2s;
}
.nav-lamp.on { opacity: 1; }
.nav-lamp.no-anim, .nav-lamp.no-anim > i { transition: none !important; }
/* the pill behind the link */
.nav-lamp::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--lamp-x, 14px);
    right: 0;
    border-radius: 14px;
    background: rgba(48, 34, 140, 0.34);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 10px 20px -12px rgba(20, 10, 80, 0.7);
}
/* the light source */
.nav-lamp-bar {
    position: absolute;
    left: 0;
    top: 18%;
    bottom: 18%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: #fff;
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.75), 0 0 22px 4px rgba(190, 175, 255, 0.55);
    z-index: 2;
}
/* the beam: narrow at the bar, widening across the link */
.nav-lamp-beam {
    position: absolute;
    left: 2px;
    top: -6px;
    bottom: -6px;
    right: 0;
    z-index: 1;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0.26) 30%, rgba(255, 255, 255, 0.08) 70%, transparent 100%);
    clip-path: polygon(0 36%, 100% 0, 100% 100%, 0 64%);
    filter: blur(1.5px);
    transition: opacity 0.35s ease;
}
.nav-lamp.moving .nav-lamp-beam { opacity: 0.25; transition-duration: 0.12s; }
@media (prefers-reduced-motion: reduce) {
    .nav-lamp, .nav-lamp-beam { transition: none; }
}

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, 0.14); padding: 14px; }
.user-chip .name { color: #fff; font-weight: 600; }
.user-chip .role { color: rgba(255, 255, 255, 0.6); font-weight: 500; }
.sidebar-foot .avatar.grad { background: #fff; color: var(--brand-blue); }
#logout-btn {
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 12px;
}
#logout-btn:hover { background: rgba(255, 255, 255, 0.24); color: #fff; border: none; }

/* ---------- Main column & top bar ---------- */
#main-content { margin-left: var(--sidebar-w); }

.topbar {
    background: rgba(236, 234, 246, 0.78);
    border-bottom: none;
    padding: 0 28px 0 16px;
    height: 76px;
}
.topbar-search input {
    height: 44px;
    border: none;
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}
.topbar-search input:focus { box-shadow: var(--ring), var(--shadow-xs); }
.topbar-date { color: var(--ink-2); font-weight: 500; }
.conn-pill { border: none !important; box-shadow: var(--shadow-xs); height: 34px; font-weight: 600; }
.topbar .btn-primary { height: 40px; }

.page { padding: 8px 28px 56px 16px; max-width: 1600px; }
.page-head { margin-bottom: 20px; }
.page-head .lede { color: var(--ink-3); }

/* ---------- Surfaces ---------- */
.card,
.toolbar,
.lead-card,
.lead-finder-card,
.lf-filter-sidebar,
.lf-results-header,
.wizard-card,
.calendar-day-col {
    border: none;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}
.card { padding: 22px 24px; }
.lead-card:hover, .lead-finder-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.toolbar { padding: 12px; }
.toolbar input, .toolbar select { background-color: var(--surface-2); border-color: transparent; }

.panel-title .tile-ic { border-radius: 14px; width: 42px; height: 42px; background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-violet); }
.panel-title .tile-ic.teal { background: var(--pink-gradient); color: #fff; box-shadow: var(--shadow-pink); }

/* ---------- Buttons ---------- */
.btn { border-radius: 12px; font-weight: 600; }
.btn-sm { border-radius: 10px; }
.btn-primary {
    background: var(--brand-gradient);
    box-shadow: 0 8px 18px -10px rgba(108, 93, 211, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: linear-gradient(135deg, #7c6ee8 0%, #5d4ec6 100%); }
.btn-secondary { border-color: var(--line); box-shadow: none; }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn-success { background: linear-gradient(135deg, #34c98a, #22b573); }
.btn-soft-blue { background: var(--blue-soft); color: var(--brand-blue); border-color: transparent; }
.btn-soft-blue:hover { background: #e4dffc; }
.icon-btn { border-radius: 10px; }
.icon-btn:hover { background: var(--blue-soft); color: var(--brand-blue); }
.icon-btn.bordered { border-color: var(--line); }

/* ---------- Fields ---------- */
input, select, textarea { border-radius: 12px; border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { border-color: var(--brand-blue); }

/* ---------- Tabs & segmented ---------- */
.tab-btn { border: none; background: var(--surface); box-shadow: var(--shadow-xs); font-weight: 600; height: 34px; padding: 0 15px; }
.tab-btn:hover { color: var(--brand-blue); }
.tab-btn.active { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-violet); }
.segmented { background: var(--surface-3); border-radius: 14px; padding: 4px; }
.chart-period-tab { border-radius: 10px; font-weight: 600; }
.chart-period-tab.active { background: var(--brand-blue); color: #fff; box-shadow: var(--shadow-violet); }

/* ---------- Tables ---------- */
th { background: var(--surface-2); color: var(--ink-3); font-weight: 600; }
tbody tr:hover td { background: #faf9ff; }

/* ---------- Badges / progress ---------- */
.status-badge { font-weight: 600; }
.chip { border-radius: 8px; font-weight: 600; }
.progress { background: var(--surface-3); }
.progress > span { background: linear-gradient(90deg, #22b573, #4fd69c); }

/* ---------- Kanban ---------- */
.kanban-col { background: #e6e3f4; border-radius: var(--r-lg); padding: 12px; }
.kanban-card { border: none; border-radius: 14px; box-shadow: var(--shadow-xs); }
.kanban-card:hover { box-shadow: var(--shadow-sm); }
.kanban-col.drag-over { background: var(--blue-soft); border-color: var(--brand-blue); }
.kanban-count { box-shadow: var(--shadow-xs); }

/* ---------- Follow-ups ---------- */
.follow-up-item { border-left: none; box-shadow: var(--shadow-xs); position: relative; overflow: hidden; }
.follow-up-item::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand-blue); }
.follow-up-item.overdue::before { background: var(--brand-pink); }
.follow-up-item.done::before { background: var(--green); }
.fu-summary .pill { border: none; box-shadow: var(--shadow-xs); }
.badge-overdue { background: var(--teal-soft); color: #d9466f; }

/* ---------- Modals ---------- */
.modal { background: rgba(42, 39, 83, 0.38); }
.modal-content { border: none; border-radius: var(--r-xl); }

/* ---------- Login ---------- */
#login-screen { background: radial-gradient(1200px 600px at 10% 0%, #f5f3ff 0%, var(--canvas) 60%); }
.login-shell { border: none; border-radius: 28px; }
.login-brand { background: linear-gradient(160deg, #8070ea 0%, #6c5dd3 50%, #5040bb 100%); }
.stripes span:nth-child(1) { background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04)); }
.stripes span:nth-child(2) { background: linear-gradient(180deg, rgba(247,161,191,0.7), rgba(239,106,149,0.35)); }
.stripes span:nth-child(3) { background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.05)); }
.login-brand .mark img { border-radius: 14px; }

/* ---------- Chat apps: keep their native look, soften the frame ---------- */
.wa-app { border: none; border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }

/* =====================================================================
   Dashboard
   ===================================================================== */
.dash-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
}
.dash-main { min-width: 0; }
.dash-main > .card:last-child { margin-bottom: 0; }

.dash-title { margin: 4px 0 18px; }
.dash-title .eyebrow { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.dash-title h1 { font-size: 26px; margin: 0; }

.dash-top {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(240px, 1fr);
    gap: 22px;
    margin-bottom: 64px;
}

/* Overview card */
.ov-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: #fff;
    background: linear-gradient(160deg, #8576ec 0%, #6c5dd3 48%, #5545c0 100%);
    border-radius: 26px;
    padding: 20px 22px 0;
    box-shadow: 0 26px 46px -22px rgba(92, 75, 205, 0.85);
}
.ov-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ov-head h3 { margin: 0; color: #fff; font-size: 16px; font-weight: 600; }
.ov-select {
    width: auto;
    min-height: 0 !important;
    height: 32px;
    padding: 0 30px 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background-color: transparent;
    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='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 10px center;
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
}
.ov-select:hover { border-color: rgba(255, 255, 255, 0.7); }
.ov-select:focus { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2); }
.ov-select option { color: var(--ink); }

.ov-chart { position: relative; height: 150px; margin: 10px -4px 0; }
.ov-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ov-col { fill: rgba(255, 255, 255, 0.13); }
.ov-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f590b2;
    border: 3px solid #fff;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 12px rgba(239, 106, 149, 0.7);
    pointer-events: none;
}
.ov-tip {
    position: absolute;
    transform: translate(14px, -115%);
    padding: 7px 12px;
    border-radius: 10px;
    background: rgba(44, 32, 128, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 11.5px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    pointer-events: none;
}
.ov-tip.left { transform: translate(calc(-100% - 14px), -115%); }
.ov-tip b { display: block; color: #fff; font-size: 15px; font-weight: 600; }

.ov-axis { display: grid; margin: 8px -4px 14px; }
.ov-axis button {
    justify-self: center;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.66);
    font-size: 11.5px;
    font-weight: 500;
    height: 24px;
    padding: 0 9px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}
.ov-axis button:hover { color: #fff; }
.ov-axis button.active { background: #fff; color: var(--brand-blue); font-weight: 600; }

.ov-stats {
    display: grid;
    grid-template-columns: 1fr 1.15fr 1fr;
    align-items: end;
    gap: 12px;
    margin: 0 -22px;
    padding: 0 22px 20px;
    border-radius: 0 0 26px 26px;
    background: linear-gradient(180deg, rgba(60, 44, 160, 0) 0%, rgba(60, 44, 160, 0.42) 100%);
}
.ov-stat { text-align: center; min-width: 0; padding-top: 14px; }
.ov-stat .k-label { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.7); font-weight: 500; }
.ov-stat .k-value { display: block; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.ov-stat .k-foot { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.7); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-stat-focus {
    margin-top: -10px;
    padding: 16px 10px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 16px 30px -18px rgba(20, 10, 80, 0.8);
}
.ov-stat-focus .k-value { font-size: 28px; }
.k-foot.up { color: #b9f5d6 !important; }
.k-foot.warn { color: #ffe1a8 !important; }

/* Side cards */
.dash-side-cards { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.pill-ic {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.32);
}
.pill-ic .ic { width: 24px; height: 24px; }
.pill-card {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(140deg, #8576ec 0%, #6c5dd3 100%);
    color: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow-violet);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.pill-card:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(108, 93, 211, 0.7); }
.pill-txt { min-width: 0; display: flex; flex-direction: column; }
.pill-txt b { font-size: 16px; font-weight: 600; }
.pill-txt .k-foot { font-size: 11.5px; color: rgba(255, 255, 255, 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pink-card {
    position: relative;
    flex: 1;
    min-height: 210px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    border-radius: 26px;
    background: var(--pink-gradient);
    color: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-pink);
}
.pink-top { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; }
.pink-top b { font-size: 16px; font-weight: 600; }
.pink-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 62%; fill: rgba(255, 255, 255, 0.13); }
.pink-foot { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.pink-foot .k-label { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.82); font-weight: 500; }
.pink-foot .k-value { display: block; font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.pink-foot .k-foot { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.85); font-weight: 500; }
.round-go {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}
.round-go:hover { background: rgba(255, 255, 255, 0.2); }

/* Stage cards with floating icon */
.stage-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 22px;
}
.stage-card {
    position: relative;
    background: var(--surface);
    border-radius: 22px;
    padding: 44px 18px 16px;
    text-align: center;
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    min-width: 0;
}
.stage-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stage-ic {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: var(--brand-gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-violet);
    border: 4px solid var(--canvas);
}
.stage-ic .ic { width: 24px; height: 24px; }
.stage-card h4 { font-size: 15px; font-weight: 600; margin-top: 2px; }
.stage-sub { font-size: 12px; color: var(--ink-3); margin-bottom: 14px; }
.stage-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.stage-row b { font-weight: 600; color: var(--ink); }
.stage-bar { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.stage-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22b573, #4fd69c); }
.stage-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; font-size: 11.5px; color: var(--ink-3); }
.stage-chip { padding: 5px 10px; border-radius: 999px; background: #fde6ee; color: #e0507c; font-weight: 600; white-space: nowrap; }

/* Pipeline snapshot & team table on the new surfaces */
.pipe-bar { height: 10px; gap: 3px; }
.pipe-legend .item { border: none; background: var(--surface-2); border-radius: 14px; }
.pipe-legend .item:hover { background: var(--blue-soft); }
.pipe-legend .val { font-weight: 600; }
.team-row .num { font-weight: 600; }

/* Right rail */
.dash-rail {
    position: sticky;
    top: 92px;
    background: var(--surface);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-xs);
    padding: 22px;
    min-width: 0;
}
.rail-block + .rail-block { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rail-head h3 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 15px; }
.rail-head h3 .ic { color: var(--brand-blue); }
.rail-link { border: none; background: none; color: var(--brand-blue); font-weight: 600; font-size: 12px; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.rail-link:hover { background: var(--blue-soft); }

.dash-rail .agenda-item { align-items: center; padding: 10px 0; border-bottom: none; }
.dash-rail .agenda-item .what .nm { font-weight: 600; font-size: 13px; }
.dash-rail .agenda-item .what .nt { font-size: 11.5px; color: var(--ink-3); }
.dash-rail .agenda-item .what .wh { font-size: 10.5px; color: var(--ink-3); }
.dash-rail .agenda-item.overdue .wh { color: #e0507c; font-weight: 600; }
.dash-rail .agenda-item .icon-btn { color: var(--brand-blue); background: var(--blue-soft); }
.dash-rail .leaderboard-item { border-bottom: none; padding: 8px 0; }
.leaderboard-rank { border-radius: 10px; }
.top-1 { background: var(--brand-gradient); color: #fff; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1360px) {
    .dash-layout { grid-template-columns: minmax(0, 1fr); }
    .dash-rail { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
    .rail-block + .rail-block { border-top: none; margin-top: 0; padding-top: 0; border-left: 1px solid var(--line); padding-left: 28px; }
}

@media (max-width: 1024px) {
    /* Sidebar becomes a drawer that keeps the violet look */
    #sidebar { top: 0; bottom: 0; left: 0; border-radius: 0 var(--r-xl) var(--r-xl) 0; transform: translateX(-105%); }
    #sidebar.open { transform: translateX(0); }
    #main-content { margin-left: 0; }
    .topbar { padding: 0 16px; height: calc(68px + env(safe-area-inset-top)); }
    .mobile-menu-toggle { border: none; background: var(--surface); box-shadow: var(--shadow-xs); width: 42px; height: 42px; border-radius: 12px; }
    .page { padding: 8px 16px 48px; }

    /* Floating bottom tab bar */
    .mobile-tabbar {
        left: 12px !important;
        right: 12px !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        height: 64px !important;
        padding: 6px !important;
        border: none !important;
        border-radius: 22px;
        background: rgba(255, 255, 255, 0.94) !important;
        box-shadow: 0 18px 40px -16px rgba(52, 40, 130, 0.45) !important;
        gap: 4px;
    }
    .mobile-tabbar button { border-radius: 16px; font-weight: 500 !important; transition: background 0.15s, color 0.15s; }
    .mobile-tabbar button.active { color: #fff !important; background: var(--brand-gradient); box-shadow: var(--shadow-violet); }
    .mobile-tabbar button.active::before { display: none; }
    .mobile-tabbar .tab-pip { top: 6px !important; }
    .page { padding-bottom: calc(100px + env(safe-area-inset-bottom)) !important; }
    body[data-section="whatsapp-chat"] .page { padding-bottom: 16px !important; }
    body[data-section="whatsapp-chat"]:not(.wa-chat-open) .page { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }

    .kanban-col { max-height: calc(100dvh - 280px); }
}

@media (max-width: 860px) {
    .dash-top { grid-template-columns: minmax(0, 1fr); margin-bottom: 56px; }
    .dash-side-cards { display: grid; grid-template-columns: 1fr 1fr; }
    .pink-card { min-height: 170px; }
    .dash-rail { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .rail-block + .rail-block { border-left: none; padding-left: 0; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
}

@media (max-width: 760px) {
    h1, .dash-title h1 { font-size: 22px; }
    .card { padding: 18px 16px; border-radius: 20px; }
    .dash-title { margin: 2px 0 14px; }
    .ov-card { padding: 16px 16px 0; border-radius: 24px; }
    .ov-chart { height: 120px; }
    .ov-stats { margin: 0 -16px; padding: 0 10px 16px; gap: 6px; }
    .ov-stat .k-value { font-size: 18px; }
    .ov-stat-focus { padding: 12px 6px 10px; border-radius: 16px; }
    .ov-stat-focus .k-value { font-size: 21px; }
    .ov-stat .k-label, .ov-stat .k-foot { font-size: 10.5px; }
    .ov-select { height: 34px; font-size: 14px !important; }

    /* Stage cards swipe sideways */
    .stage-cards {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 78%;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        margin: -34px -16px 18px;
        padding: 34px 16px 8px;
        scroll-padding: 0 16px;
        gap: 14px;
    }
    .stage-cards::-webkit-scrollbar { display: none; }
    .stage-card { scroll-snap-align: start; }
    .dash-rail { padding: 18px 16px; border-radius: 22px; }

    .tab-btn { height: 36px; }
    .topbar .btn-primary { width: 42px; height: 42px; border-radius: 12px; }
    .topbar .conn-pill { width: 34px; }
    .login-shell { border-radius: 24px; }
}

@media (max-width: 480px) {
    .dash-side-cards { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .pill-card { padding: 12px; border-radius: 20px; }
    .pill-ic { width: 46px; height: 46px; border-radius: 14px; }
    .pink-card { min-height: 150px; border-radius: 22px; }
    .ov-axis button { padding: 0 6px; font-size: 11px; }
    .ov-stat:not(.ov-stat-focus) .k-foot { display: none; }
}

/* =====================================================================
   Pipeline: one swipeable row of stages, stage jump strip, touch "Move to"
   ===================================================================== */
.kanban-board {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 276px;
    scroll-snap-type: x proximity;
    scroll-padding: 0 2px;
    padding: 2px 2px 14px;
}
.kanban-col { scroll-snap-align: start; }
.kanban-col-title { font-weight: 600; }
.kanban-stage-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: -4px 0 14px;
    padding: 4px 2px 6px;
}
.kanban-stage-nav::-webkit-scrollbar { display: none; }
.kanban-stage-nav button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 6px 0 14px;
    border: none;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    color: var(--ink-2);
    font: 500 12.5px var(--font);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.kanban-stage-nav button b {
    min-width: 24px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--ink);
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.kanban-stage-nav button:hover { color: var(--brand-blue); }
.kanban-stage-nav button.active { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-violet); }
.kanban-stage-nav button.active b { background: rgba(255, 255, 255, 0.24); color: #fff; }

.hint-touch { display: none; }
.kanban-move { display: none; }

@media (hover: none), (pointer: coarse) {
    .hint-drag { display: none; }
    .hint-touch { display: inline; }
    .kanban-card { cursor: pointer; touch-action: manipulation; user-select: auto; }
    .kanban-move {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--line);
        font-size: 11.5px;
        font-weight: 500;
        color: var(--ink-3);
    }
    .kanban-move select {
        flex: 1;
        min-width: 0;
        min-height: 36px !important;
        padding: 0 30px 0 10px;
        border-radius: 10px;
        border-color: transparent;
        background-color: var(--blue-soft);
        color: var(--brand-blue);
        font-weight: 600;
    }
}

@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: none !important;
        grid-auto-columns: min(84vw, 340px);
        scroll-snap-type: x mandatory;
        margin: 0 -16px;
        padding: 2px 16px 12px;
        scroll-padding: 0 16px;
    }
    .kanban-stage-nav { margin: -4px -16px 12px; padding: 4px 16px 6px; }
    .kanban-col { max-height: calc(var(--app-vh, 1vh) * 100 - 330px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 300px; }
    #kanban .page-actions, #kanban .page-actions .field-ic { width: 100% !important; }
}
@media (max-width: 760px) {
    #kanban .page-head { gap: 10px; margin-bottom: 14px; }
    .kanban-card-actions .icon-btn { width: 36px; height: 36px; }
}

/* =====================================================================
   Instagram inbox
   ===================================================================== */
#instagram-chat .ig-app { border: none; border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
#instagram-chat .ig-page-actions { flex-wrap: wrap; }

@media (max-width: 1024px) {
    /* Fill the screen between the top bar and the floating tab bar */
    #instagram-chat.active {
        display: flex;
        flex-direction: column;
        height: calc(var(--app-vh, 1vh) * 100 - 68px - env(safe-area-inset-top) - 8px - 92px - env(safe-area-inset-bottom));
        min-height: 420px;
    }
    body.ig-chat-open #instagram-chat.active {
        height: calc(var(--app-vh, 1vh) * 100 - 68px - env(safe-area-inset-top) - 8px - 12px - env(safe-area-inset-bottom));
    }
    body[data-section="instagram-chat"] .page { padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important; }
    body.ig-chat-open[data-section="instagram-chat"] .page { padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important; }
    body.ig-chat-open .mobile-tabbar { display: none !important; }
    #instagram-chat .page-head { flex-shrink: 0; margin-bottom: 12px; }
    #instagram-chat .ig-app { flex: 1; height: auto !important; min-height: 0 !important; }
}
@media (max-width: 760px) {
    #instagram-chat .page-head { flex-direction: row; align-items: center; flex-wrap: nowrap; gap: 10px; }
    #instagram-chat .page-head .lede { display: none; }
    #instagram-chat .page-head h1 { font-size: 20px; margin: 0; white-space: nowrap; }
    #instagram-chat .ig-page-actions { margin-left: auto; flex-wrap: nowrap; gap: 6px; }
    #instagram-chat .ig-page-actions .btn { height: 36px; min-height: 36px; padding: 0 10px; }
    #instagram-chat .ig-tab-btn { height: 48px; font-size: 13px; }
    #instagram-chat .ig-search { margin: 12px 12px 8px; }
    #instagram-chat .ig-filters { padding: 0 12px 8px; }
    #instagram-chat .ig-conversation { padding: 8px 12px; }
    #instagram-chat .ig-avatar { width: 48px; height: 48px; flex-basis: 48px; }
    #instagram-chat .ig-avatar-sm { width: 28px; height: 28px; flex-basis: 28px; }
    #instagram-chat .ig-thread-head .ig-avatar { width: 36px; height: 36px; flex-basis: 36px; }
    #instagram-chat .ig-back { width: 40px; height: 40px; font-size: 28px; }
    #instagram-chat .ig-reply-form { padding-bottom: 10px; }
    #instagram-chat .ig-composer textarea { font-size: 16px; }
}

/* Stage colour dots (match the dashboard pipeline) */
.kanban-col[data-status="Not interested"] .kanban-col-header::before { background: #ef6a95; }
.kanban-col[data-status="Voice mail"] .kanban-col-header::before { background: #a99cf5; }
.kanban-col[data-status="Call back"] .kanban-col-header::before { background: #6c5dd3; }
.kanban-col[data-status="Not connected"] .kanban-col-header::before { background: #c9c5e3; }
.kanban-col[data-status="Wrong number"] .kanban-col-header::before { background: #d94c6e; }
.kanban-col[data-status="Interested"] .kanban-col-header::before { background: #22b573; }
.kanban-col[data-status="Ivr"] .kanban-col-header::before { background: #8e8bb3; }
.kanban-col[data-status="No answer"] .kanban-col-header::before { background: #f590b2; }
.kanban-col[data-status="Contacted"] .kanban-col-header::before { background: #f2a541; }
.kanban-col[data-status="Email sent"] .kanban-col-header::before { background: #3fb5c8; }

/* =====================================================================
   Meetings & appointments calendar
   ===================================================================== */
.mc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.mc-nav { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mc-nav.hidden { visibility: hidden; }
.mc-nav h2 { font-size: 19px; font-weight: 600; margin-left: 6px; white-space: nowrap; }
.mc-nav .icon-btn { width: 36px; height: 36px; border: none; background: var(--surface); box-shadow: var(--shadow-xs); }

.mc-calendar { margin-bottom: 20px; }

/* Event chips */
.mc-ev {
    display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0;
    padding: 3px 7px; margin-top: 3px; border: none; border-radius: 8px;
    font: 500 11.5px/1.35 var(--font); text-align: left; cursor: pointer;
    background: var(--blue-soft); color: #4b3fae; box-shadow: inset 3px 0 0 var(--brand-blue);
    transition: transform .12s, box-shadow .12s;
}
.mc-ev:hover { transform: translateY(-1px); box-shadow: inset 3px 0 0 var(--brand-blue), var(--shadow-xs); }
.mc-ev b { font-weight: 600; flex-shrink: 0; }
.mc-ev span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-ev.appt { background: #fde8ef; color: #c23d68; box-shadow: inset 3px 0 0 var(--brand-pink); }
.mc-ev.appt:hover { box-shadow: inset 3px 0 0 var(--brand-pink), var(--shadow-xs); }
.mc-ev.done { opacity: .6; }
.mc-ev.cancelled span { text-decoration: line-through; }
.mc-ev.cancelled { opacity: .5; }
.mc-ev.dragging { opacity: .35; }

/* Month */
.mc-month {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.mc-dow { padding: 12px 10px 8px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.mc-day {
    min-height: 116px; padding: 6px 7px 8px; border-top: 1px solid var(--line); border-left: 1px solid var(--line);
    cursor: pointer; transition: background .12s; min-width: 0;
}
.mc-day:nth-child(7n + 1) { border-left: none; }
.mc-day:hover { background: #fbfaff; }
.mc-day.wknd { background: #fcfbff; }
.mc-day.out .mc-dnum span { color: var(--ink-3); opacity: .55; }
.mc-day.sel { background: var(--blue-soft); }
.mc-day.drop, .mc-slot.drop { background: #e4defc !important; box-shadow: inset 0 0 0 2px var(--brand-blue); }
.mc-dnum { display: flex; align-items: center; justify-content: space-between; height: 26px; }
.mc-dnum span { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.mc-day.today .mc-dnum span { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-violet); }
.mc-add {
    width: 24px; height: 24px; border: none; border-radius: 8px; background: transparent; color: var(--brand-blue);
    font-size: 17px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s, background .12s;
}
.mc-day:hover .mc-add { opacity: 1; }
.mc-add:hover { background: var(--blue-soft); }
.mc-more { border: none; background: none; padding: 3px 6px; margin-top: 2px; font: 600 11px var(--font); color: var(--brand-blue); cursor: pointer; border-radius: 6px; }
.mc-more:hover { background: var(--blue-soft); }

/* Week */
.mc-week { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.mc-wk-head, .mc-wk-body { display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); }
.mc-wk-head { border-bottom: 1px solid var(--line); }
.mc-wk-day { padding: 10px 6px; text-align: center; }
.mc-wk-day span { display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.mc-wk-day b { display: inline-flex; width: 32px; height: 32px; margin-top: 2px; border-radius: 50%; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }
.mc-wk-day.today b { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-violet); }
.mc-wk-body { max-height: min(640px, calc(100vh - 330px)); overflow-y: auto; position: relative; }
.mc-wk-times div { height: var(--mc-row); padding: 0 8px; font-size: 10.5px; color: var(--ink-3); text-align: right; transform: translateY(-7px); }
.mc-wk-times div:first-child { transform: none; }
.mc-wk-col { position: relative; border-left: 1px solid var(--line); }
.mc-wk-col.today { background: #fbfaff; }
.mc-slot { height: var(--mc-row); border-top: 1px solid var(--line); cursor: pointer; transition: background .1s; }
.mc-slot:first-child { border-top: none; }
.mc-slot:hover { background: rgba(108, 93, 211, .05); }
.mc-wk-col .mc-ev { position: absolute; margin: 0; flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 7px; overflow: hidden; z-index: 1; }
.mc-wk-col .mc-ev span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mc-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--brand-pink); z-index: 2; pointer-events: none; }
.mc-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-pink); }

/* Day agenda (under the month grid, and the phone week view) */
.mc-agenda { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); padding: 18px 20px; margin-bottom: 20px; }
.mc-ag-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.mc-ag-head h3 { margin: 0; font-size: 15px; }
.mc-ag-item {
    display: flex; gap: 14px; padding: 12px; margin-top: 8px; border-radius: 14px; cursor: pointer;
    background: var(--surface-2); box-shadow: inset 4px 0 0 var(--brand-blue); transition: background .12s;
}
.mc-ag-item:hover { background: var(--blue-soft); }
.mc-ag-item.appt { box-shadow: inset 4px 0 0 var(--brand-pink); }
.mc-ag-item.appt:hover { background: #fdf0f5; }
.mc-ag-item.cancelled { opacity: .55; }
.mc-ag-item.cancelled .mc-ag-title { text-decoration: line-through; }
.mc-ag-time { width: 64px; flex-shrink: 0; padding-left: 6px; display: flex; flex-direction: column; }
.mc-ag-time b { font-size: 13px; font-weight: 600; }
.mc-ag-time span { font-size: 11.5px; color: var(--ink-3); }
.mc-ag-main { min-width: 0; flex: 1; }
.mc-ag-title { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.mc-ag-sub { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.mc-ag-link { margin-top: 8px; }
.mc-place { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.mc-ag-empty { padding: 18px 4px 6px; color: var(--ink-3); font-size: 13px; }
.mc-ag-day + .mc-ag-day { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.mc-ag-day.today .mc-ag-head h3 { color: var(--brand-blue); }

.mc-type { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--blue-soft); color: var(--brand-blue); }
.mc-type.appt { background: #fde8ef; color: #c23d68; }

/* Modal: meeting / appointment */
.meeting-form { display: flex; flex-direction: column; gap: 14px; }
.meeting-form .form-row { margin-bottom: 0; }
.mt-type { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px; background: var(--surface-3); border-radius: 14px; }
.mt-type label { margin: 0; cursor: pointer; }
.mt-type input { position: absolute; opacity: 0; pointer-events: none; }
.mt-type span {
    display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: 11px;
    font-size: 13.5px; font-weight: 600; color: var(--ink-2); transition: background .15s, color .15s, box-shadow .15s;
}
.mt-type input:checked + span { background: var(--surface); color: var(--brand-blue); box-shadow: var(--shadow-xs); }
.mt-type label:last-child input:checked + span { color: #c23d68; }
.mt-type input:focus-visible + span { box-shadow: var(--ring); }
.meeting-form .form-actions { margin-top: 6px; }
.meeting-form .form-actions .btn { min-width: 0; }

@media (max-width: 1100px) {
    .mc-day { min-height: 96px; }
}
@media (max-width: 760px) {
    #meetings .page-actions { display: grid; grid-template-columns: 1fr 1fr; }
    #meetings .page-actions .btn { width: 100%; }
    .mc-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .mc-nav h2 { font-size: 17px; margin-left: 4px; flex: 1; text-align: right; }
    .mc-nav.hidden { display: none; }
    #mc-views { display: grid; grid-template-columns: repeat(3, 1fr); }
    .mc-month { border-radius: 20px; }
    .mc-dow { padding: 10px 0 6px; text-align: center; font-size: 11px; }
    .mc-day { min-height: 54px; padding: 4px 2px 6px; display: flex; flex-direction: column; align-items: center; border-left: none; }
    .mc-day.wknd { background: transparent; }
    .mc-day.sel { background: transparent; }
    .mc-day.sel .mc-dnum span { box-shadow: inset 0 0 0 2px var(--brand-blue); }
    .mc-day.today.sel .mc-dnum span { box-shadow: var(--shadow-violet); }
    .mc-dnum { justify-content: center; height: 30px; }
    .mc-dnum span { width: 30px; height: 30px; font-size: 13.5px; }
    .mc-dots { display: flex; gap: 3px; height: 6px; margin-top: 2px; }
    .mc-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-blue); }
    .mc-dots i.appt { background: var(--brand-pink); }
    .mc-agenda { padding: 16px; border-radius: 20px; }
    .mc-ag-item { padding: 12px 10px; }
    .mc-ag-time { width: 58px; }
    .meeting-form .form-row { grid-template-columns: 1fr; gap: 14px; }
    .meeting-form .form-actions { flex-wrap: wrap; }
    .meeting-form .form-actions #meeting-delete-btn { order: 3; flex: 1 1 100%; margin-right: 0 !important; }
}
.mc-wk-col .mc-ev.short { flex-direction: row; align-items: center; gap: 5px; padding: 2px 7px; }
.mc-wk-col .mc-ev.short span { -webkit-line-clamp: 1; white-space: nowrap; display: block; }

/* Team & access: role dropdown (admins) */
.role-select {
    width: auto;
    min-width: 150px;
    min-height: 34px !important;
    height: 34px;
    padding: 0 30px 0 12px;
    border-radius: 999px;
    border-color: transparent;
    background-color: var(--blue-soft);
    color: var(--brand-blue);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.role-select:hover { border-color: var(--line-2); }
.role-select:disabled { opacity: 0.6; cursor: wait; }
@media (max-width: 760px) { .role-select { min-width: 0; height: 38px; min-height: 38px !important; } }

/* Dashboard pipeline: "Deal closed" tile opens the Deal closing page */
.pipe-legend .item.deal-closed { background: #eaf8f1; }
.pipe-legend .item.deal-closed:hover { background: #dcf3e7; }
.pipe-legend .item.deal-closed .val { color: #16915a; }
