:root {
    --brand: #2f4ef7;
    --brand-600: #2740d8;
    --brand-50: #eef1ff;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e5e7eb;
    --bg: #f5f7fb;
    --card: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
}

html { font-size: 14px; position: relative; min-height: 100%; }
body.app-body { background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin-bottom: 0; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.app-sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #111c3a 100%);
    color: #cbd5e1;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg,#2f4ef7,#7c3aed); color:#fff; font-weight:700; display:flex; align-items:center; justify-content:center; font-size:1.1rem; }
.brand-title { color: #fff; font-weight: 700; letter-spacing: .2px; }
.brand-sub { color: #94a3b8; font-size: .75rem; }
.sidebar-nav { padding-top: .5rem; gap: .15rem; }
.nav-section-label { color: #64748b; font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .85rem .8rem .25rem; }
.sidebar-nav .nav-link { color: #cbd5e1; display: flex; align-items: center; gap: .65rem; padding: .55rem .8rem; border-radius: 8px; font-weight: 500; }
.sidebar-nav .nav-link i { font-size: 1.05rem; opacity: .85; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(47,78,247,.4); }
.sidebar-footer { margin-top: auto; padding: 1rem; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-footer a { color: #cbd5e1; }
.sidebar-footer a:hover { color: #fff; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-topbar { display: flex; align-items: center; gap: .5rem; padding: .9rem 1.5rem; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-title { font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.app-content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--line); background: #fff; }

/* Topbar user menu */
.user-menu-trigger {
    display: flex; align-items: center; gap: .6rem;
    padding: .3rem .65rem .3rem .35rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
}
.user-menu-trigger:hover, .user-menu-trigger:focus { background: #f8fafc; border-color: #cbd5e1; }
.user-menu-trigger .user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #2f4ef7, #7c3aed);
    color: #fff; font-weight: 700; font-size: .85rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.user-menu-trigger .user-meta { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.user-menu-trigger .user-name { font-size: .85rem; font-weight: 600; }
.user-menu-trigger .user-role { font-size: .7rem; color: var(--muted); }
.user-menu-trigger .user-caret { font-size: .75rem; color: var(--muted); margin-left: .15rem; }
.user-dropdown { min-width: 240px; border-radius: 12px; border: 1px solid var(--line); padding: .35rem; }
.user-dropdown .dropdown-item { border-radius: 8px; padding: .5rem .75rem; font-size: .9rem; }
.user-dropdown .dropdown-item:hover { background: #f1f5f9; }
.user-dropdown .dropdown-item.text-danger:hover { background: #fef2f2; color: #b91c1c; }

/* Sidebar user/sign-out */
.sidebar-user-avatar {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #2f4ef7, #7c3aed);
    color: #fff; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-name { color: #fff; font-size: .85rem; font-weight: 600; }
.sidebar-user-role { color: #94a3b8; font-size: .72rem; }
.sidebar-signout {
    background: rgba(239, 68, 68, .12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .25);
    font-weight: 600;
}
.sidebar-signout:hover { background: rgba(239, 68, 68, .9); color: #fff; border-color: rgba(239, 68, 68, .9); }

@@media (max-width: 991px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar { position: fixed; left: -280px; width: 260px; transition: left .2s ease; z-index: 100; }
    body.sidebar-open .app-sidebar { left: 0; }
}

/* Cards */
.card { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; }
.stat-card { padding: 1.1rem 1.2rem; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.stat-card .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; color: var(--ink); margin-top: .25rem; }
.stat-card .delta { font-size: .8rem; color: var(--muted); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }

/* Buttons */
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }

/* Tables */
.table { background: #fff; border-radius: 12px; overflow: hidden; }
.table > :not(caption) > * > * { padding: .85rem .9rem; }
.table thead th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line); }
.table-hover tbody tr:hover { background: #f8fafc; }

/* Badges */
.badge-soft { display: inline-block; padding: .25rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .02em; }
.badge-soft.s-prospecting { background: #f1f5f9; color: #475569; }
.badge-soft.s-qualification { background: #e0f2fe; color: #075985; }
.badge-soft.s-proposal { background: #fef3c7; color: #92400e; }
.badge-soft.s-negotiation { background: #ede9fe; color: #5b21b6; }
.badge-soft.s-won { background: #dcfce7; color: #166534; }
.badge-soft.s-lost { background: #fee2e2; color: #991b1b; }

.badge-soft.t-training { background: #ecfdf5; color: #065f46; }
.badge-soft.t-managedservice { background: #eff6ff; color: #1e40af; }
.badge-soft.t-project { background: #fdf2f8; color: #9d174d; }
.badge-soft.t-consulting { background: #f5f3ff; color: #5b21b6; }
.badge-soft.t-other { background: #f1f5f9; color: #475569; }

.badge-soft.p-low { background: #f1f5f9; color: #475569; }
.badge-soft.p-medium { background: #e0f2fe; color: #075985; }
.badge-soft.p-high { background: #fef3c7; color: #92400e; }
.badge-soft.p-urgent { background: #fee2e2; color: #991b1b; }

.badge-soft.k-open { background: #f1f5f9; color: #475569; }
.badge-soft.k-inprogress { background: #e0f2fe; color: #075985; }
.badge-soft.k-done { background: #dcfce7; color: #166534; }
.badge-soft.k-cancelled { background: #fee2e2; color: #991b1b; }

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item::before { content: ""; position: absolute; left: -1.5rem; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand-50); }
.timeline-item.t-meeting::before { background: #2f4ef7; }
.timeline-item.t-call::before { background: #10b981; }
.timeline-item.t-whatsapp::before { background: #22c55e; }
.timeline-item.t-email::before { background: #0ea5e9; }
.timeline-item.t-sitevisit::before { background: #f59e0b; }
.timeline-item.t-demo::before { background: #a855f7; }
.timeline-item.t-note::before { background: #64748b; }

/* Auth */
.auth-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 2rem;
    background:
        radial-gradient(circle at 15% 20%, rgba(124, 58, 237, .18), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(47, 78, 247, .22), transparent 50%),
        linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #312e81 100%);
}
.auth-card { background: #fff; padding: 2rem 2.25rem; border-radius: 16px; box-shadow: 0 10px 40px rgba(15,23,42,.18); width: 100%; max-width: 440px; }
.auth-card .brand { padding: 0 0 1rem; border: 0; }

.auth-card-split {
    width: 100%;
    max-width: 1040px;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(2, 6, 23, .45), 0 4px 16px rgba(2, 6, 23, .25);
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 580px;
}

/* Hero side */
.auth-hero {
    position: relative;
    color: #e2e8f0;
    padding: 2.5rem 2.5rem 2rem;
    background:
        radial-gradient(circle at 0% 0%, rgba(255,255,255,.08), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(124,58,237,.35), transparent 50%),
        linear-gradient(160deg, #1e1b4b 0%, #312e81 50%, #2f4ef7 100%);
    display: flex; flex-direction: column; justify-content: space-between;
    overflow: hidden;
}
.auth-hero::before {
    content: ""; position: absolute; inset: 0;
    background-image:
        radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .5;
    pointer-events: none;
}
.auth-hero-inner { position: relative; z-index: 1; }
.brand-block { display: flex; align-items: center; gap: .85rem; margin-bottom: 2.25rem; }
.brand-mark-lg { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(135deg, #fff, #e0e7ff); color: #2f4ef7; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.brand-title-lg { color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: .3px; line-height: 1.1; }
.brand-sub-lg { color: rgba(226,232,240,.75); font-size: .8rem; }
.auth-hero-title { color: #fff; font-size: 1.85rem; line-height: 1.25; font-weight: 700; margin-bottom: 1rem; letter-spacing: -0.01em; }
.auth-hero-lead { color: rgba(226,232,240,.85); font-size: .98rem; line-height: 1.6; margin-bottom: 1.75rem; max-width: 30rem; }
.auth-feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.auth-feature-list li { display: flex; align-items: center; gap: .75rem; color: rgba(226,232,240,.92); font-size: .92rem; }
.auth-feature-list li i { width: 32px; height: 32px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: rgba(255,255,255,.12); color: #fff; font-size: 1rem; }
.auth-hero-footer { position: relative; z-index: 1; color: rgba(226,232,240,.55); font-size: .8rem; padding-top: 2rem; }

/* Form side */
.auth-form-panel { padding: 2.5rem 2.75rem; display: flex; align-items: center; }
.auth-form-inner { width: 100%; max-width: 380px; margin: 0 auto; }
.auth-form-header { margin-bottom: 1.5rem; }
.auth-form-title { font-size: 1.5rem; font-weight: 700; color: var(--ink); margin: 0 0 .35rem; }
.auth-form-sub { color: var(--muted); font-size: .9rem; margin: 0; }
.auth-form-sub a { color: var(--brand); font-weight: 600; text-decoration: none; }
.auth-form-sub a:hover { text-decoration: underline; }

.auth-form-panel .form-control { border-radius: 10px; padding-top: 1.4rem; padding-bottom: .4rem; }
.auth-form-panel .form-floating > label { padding-left: .9rem; color: var(--muted); }
.auth-form-panel .btn-primary { border-radius: 10px; font-weight: 600; padding: .7rem 1rem; box-shadow: 0 8px 20px rgba(47,78,247,.25); }
.auth-form-panel .btn-primary:hover { box-shadow: 0 12px 28px rgba(47,78,247,.35); }

.auth-demo-banner {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem .9rem; margin-bottom: 1.25rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2ff, #ede9fe);
    border: 1px solid #c7d2fe;
    color: #3730a3;
}
.auth-demo-banner i { font-size: 1.2rem; color: #4f46e5; }
.auth-demo-banner code { background: rgba(255,255,255,.7); color: #312e81; padding: 1px 6px; border-radius: 4px; font-size: .8rem; }

.auth-divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--muted); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@@media (max-width: 860px) {
    .auth-card-split { grid-template-columns: 1fr; max-width: 460px; }
    .auth-hero { padding: 2rem 1.75rem 1.5rem; }
    .auth-hero-title { font-size: 1.5rem; }
    .auth-feature-list { display: none; }
    .auth-form-panel { padding: 2rem 1.75rem; }
}

/* Utilities */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 1rem; }
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--ink); }
.page-subtitle { color: var(--muted); margin: .25rem 0 0; font-size: .9rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.5rem; opacity: .5; }
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 1rem; }
.kanban-col { background: #f1f5f9; border-radius: 12px; padding: .75rem; min-height: 200px; }
.kanban-col h6 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .75rem; }
.kanban-card { background: #fff; padding: .75rem; border-radius: 8px; border: 1px solid var(--line); margin-bottom: .5rem; box-shadow: 0 1px 2px rgba(0,0,0,.03); display:block; color:inherit; text-decoration:none; }
.kanban-card:hover { border-color: var(--brand); }
.kanban-card .title { font-weight: 600; color: var(--ink); margin-bottom: .25rem; font-size: .9rem; }
.kanban-card .meta { font-size: .75rem; color: var(--muted); }
.task-row.overdue td:first-child { border-left: 3px solid var(--danger); }
.task-row.done { opacity: .6; }
.task-row.done .task-title { text-decoration: line-through; }

/* Calendar */
.cal-toolbar { display: flex; align-items: center; gap: .75rem; margin: .5rem 0 1rem; }
.cal-title { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--ink); }
.cal-nav { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; padding: 0; }
.cal-legend { display: flex; gap: .85rem; flex-wrap: wrap; align-items: center; }
.cal-legend .legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: middle; }

.cal-month { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal-week-header, .cal-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week-header { background: #f8fafc; border-bottom: 1px solid var(--line); }
.cal-week-cell { padding: .55rem .75rem; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.cal-month-grid > .cal-day { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 116px; padding: .4rem .45rem; background: #fff; display: flex; flex-direction: column; gap: .25rem; }
.cal-month-grid > .cal-day:nth-child(7n) { border-right: none; }
.cal-month-grid > .cal-day:nth-last-child(-n+7) { border-bottom: none; }
.cal-day.out-month { background: #fafbfc; }
.cal-day.out-month .cal-day-num { color: #cbd5e1; }
.cal-day.today { background: #eef2ff; }
.cal-day.today .cal-day-num { background: var(--brand); color: #fff; }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; }
.cal-day-num { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 .35rem; border-radius: 6px; font-size: .8rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.cal-day-num:hover { background: #e2e8f0; color: var(--ink); }
.cal-day-count { font-size: .65rem; font-weight: 700; color: var(--muted); background: #e2e8f0; border-radius: 999px; padding: 1px 7px; }
.cal-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-event {
    display: flex; align-items: center; gap: .35rem;
    padding: 2px 6px; border-radius: 5px;
    font-size: .72rem; line-height: 1.3;
    text-decoration: none; color: var(--ink);
    background: #eef2ff; border-left: 3px solid #6366f1;
    overflow: hidden; white-space: nowrap;
}
.cal-event-time { font-weight: 700; opacity: .8; flex-shrink: 0; }
.cal-event-title { overflow: hidden; text-overflow: ellipsis; }
.cal-event:hover { filter: brightness(.96); }
.cal-event-more { font-size: .7rem; color: var(--brand); padding: 1px 6px; text-decoration: none; font-weight: 600; }
.cal-event-more:hover { text-decoration: underline; }

.ev-prio-urgent, .legend-dot.ev-prio-urgent { background: #fee2e2; border-left-color: #dc2626; color: #7f1d1d; }
.ev-prio-high, .legend-dot.ev-prio-high { background: #ffedd5; border-left-color: #ea580c; color: #7c2d12; }
.ev-prio-medium, .legend-dot.ev-prio-medium { background: #fef3c7; border-left-color: #d97706; color: #78350f; }
.ev-prio-low, .legend-dot.ev-prio-low { background: #dcfce7; border-left-color: #16a34a; color: #14532d; }
.ev-overdue, .legend-dot.ev-overdue { background: #fee2e2; border-left-color: #b91c1c; color: #7f1d1d; }
.ev-done { background: #f1f5f9; border-left-color: #94a3b8; color: var(--muted); text-decoration: line-through; }
.ev-act, .legend-dot.ev-act { background: #ede9fe; border-left-color: #7c3aed; color: #4c1d95; }
.ev-act-meeting { background: #dbeafe; border-left-color: #2563eb; color: #1e3a8a; }
.ev-act-call { background: #d1fae5; border-left-color: #059669; color: #064e3b; }
.ev-act-whatsapp { background: #dcfce7; border-left-color: #16a34a; color: #14532d; }
.ev-act-email { background: #e0f2fe; border-left-color: #0284c7; color: #075985; }
.ev-act-demo { background: #f3e8ff; border-left-color: #9333ea; color: #581c87; }
.ev-act-sitevisit { background: #ffedd5; border-left-color: #ea580c; color: #7c2d12; }
.ev-act-note { background: #f1f5f9; border-left-color: #64748b; color: var(--ink-2); }
/* Outlook & Teams events from Microsoft Graph */
.ev-outlook, .legend-dot.ev-outlook { background: #e1edff; border-left-color: #0078d4; color: #003a6c; }
.ev-teams,   .legend-dot.ev-teams   { background: #e8d9ff; border-left-color: #5558af; color: #2d1e5e; }
/* Badge helper */
.bg-purple { background-color: #7c3aed !important; }

.legend-dot { background: #e2e8f0; border: 0 !important; }
.legend-dot.ev-act { background: #ede9fe; }

/* Week view */
.cal-week { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal-week-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week-col { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 480px; }
.cal-week-col:last-child { border-right: none; }
.cal-week-col.today { background: #eef2ff; }
.cal-week-col-head { padding: .65rem .65rem .5rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: #f8fafc; }
.cal-week-col.today .cal-week-col-head { background: #e0e7ff; }
.cal-dow { font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.cal-week-col-body { padding: .5rem; display: flex; flex-direction: column; gap: .35rem; }
.cal-empty { color: #cbd5e1; font-size: .8rem; text-align: center; padding: 1rem 0; }
.cal-event-block { white-space: normal; padding: .5rem .65rem; }
.cal-event-block .cal-event-time { display: block; font-size: .68rem; }
.cal-event-block .cal-event-title { font-weight: 600; font-size: .82rem; display: block; margin-top: 1px; }
.cal-event-block .cal-event-sub { font-size: .7rem; opacity: .8; margin-top: 1px; }

/* Day view */
.cal-day-view { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem; }
.cal-day-summary { display: flex; gap: .5rem; margin-bottom: 1rem; }
.cal-day-summary .badge { padding: .45rem .7rem; font-size: .8rem; font-weight: 600; }
.cal-day-list { display: flex; flex-direction: column; }
.cal-hour-row { display: grid; grid-template-columns: 70px 1fr; gap: .75rem; padding: .5rem 0; border-bottom: 1px dashed var(--line); min-height: 52px; }
.cal-hour-row:last-child { border-bottom: none; }
.cal-hour-label { color: var(--muted); font-size: .8rem; font-weight: 600; padding-top: .35rem; }
.cal-hour-body { display: flex; flex-direction: column; gap: .35rem; }

@@media (max-width: 768px) {
    .cal-month-grid > .cal-day { min-height: 80px; padding: .25rem; }
    .cal-event-title { display: none; }
    .cal-week-col { min-height: 200px; }
    .cal-week-grid { grid-template-columns: repeat(2, 1fr); }
    .cal-week-col { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    .cal-legend { display: none !important; }
}
/* ============================================================
   Company cards (Customers index) + multi-user / sexiness UI
   ============================================================ */
.company-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.cs-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.cs-label { font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.cs-value { font-size: 22px; font-weight: 700; color: #111827; margin-top: 4px; }
@media (max-width: 768px) { .company-summary { grid-template-columns: 1fr; } }

.company-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px;
}
.company-search { max-width: 360px; flex: 1; min-width: 240px; }

.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.company-card {
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
    padding: 18px; text-decoration: none; color: inherit;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    position: relative; overflow: hidden;
}
.company-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: linear-gradient(180deg, #cbd5e1, #cbd5e1);
}
.company-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15,23,42,.08); border-color: #c7d2fe; }
.company-card.sex-1::before { background: linear-gradient(180deg,#fcd34d,#fbbf24); }
.company-card.sex-2::before { background: linear-gradient(180deg,#fb923c,#f97316); }
.company-card.sex-3::before { background: linear-gradient(180deg,#f97316,#ef4444); }
.company-card.sex-4::before { background: linear-gradient(180deg,#ef4444,#dc2626); }
.company-card.sex-5::before { background: linear-gradient(180deg,#a855f7,#ec4899); }

.company-card-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.company-logo {
    flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg,#6366f1,#8b5cf6);
    color: #fff; font-weight: 700; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
}
.company-meta { flex: 1; min-width: 0; }
.company-name { font-weight: 700; font-size: 16px; color: #111827; line-height: 1.25; }
.company-sub { color: #6b7280; font-size: 13px; margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.company-sub .dot { width: 3px; height: 3px; border-radius: 50%; background: #9ca3af; }

.sex-badge {
    display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
    flex: 0 0 auto;
}
.sex-flames { display: inline-flex; gap: 2px; }
.sex-flames .bi-fire { color: #d1d5db; font-size: 13px; }
.sex-flames .bi-fire.lit { color: #f59e0b; }
.sex-badge-3 .sex-flames .bi-fire.lit { color: #f97316; }
.sex-badge-4 .sex-flames .bi-fire.lit { color: #ef4444; }
.sex-badge-5 .sex-flames .bi-fire.lit { color: #ec4899; }
.sex-label { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.sex-badge-4 .sex-label, .sex-badge-5 .sex-label { color: #be185d; }

.company-stats {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 6px; padding: 12px 0; border-top: 1px dashed #e5e7eb; border-bottom: 1px dashed #e5e7eb;
    margin-bottom: 12px;
}
.company-stats .stat { text-align: center; }
.company-stats .stat-num { font-weight: 700; font-size: 18px; color: #111827; line-height: 1; }
.company-stats .stat-lbl { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.company-stats .stat-won .stat-num { color: #16a34a; }
.company-stats .stat-lost .stat-num { color: #dc2626; }
.company-stats .stat-contact .stat-num { color: #2563eb; }

.company-values { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-size: 13px; }
.cv-row { display: flex; justify-content: space-between; }
.cv-lbl { color: #6b7280; }
.cv-val { color: #111827; }

.company-card-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: auto; padding-top: 10px; border-top: 1px solid #f3f4f6;
}
.reg-by { display: flex; align-items: center; gap: 8px; min-width: 0; }
.reg-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg,#0ea5e9,#6366f1); color: #fff;
    font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
    flex: 0 0 28px;
}
.reg-meta { line-height: 1.1; min-width: 0; }
.reg-lbl { font-size: 10px; color: #9ca3af; text-transform: uppercase; letter-spacing: .04em; }
.reg-name { font-size: 12px; color: #374151; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.reg-time { font-size: 11px; color: #9ca3af; white-space: nowrap; }

/* Owner pill (used in opportunity rows / activity log) */
.owner-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 8px 2px 2px; background: #eef2ff; color: #4338ca;
    border-radius: 999px; font-size: 11px; font-weight: 600;
}
.owner-pill .owner-avatar {
    width: 18px; height: 18px; border-radius: 50%;
    background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff;
    font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}

/* Role badge in user menu */
.role-badge {
    display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 999px;
    background: #ede9fe; color: #6d28d9; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    margin-left: 6px;
}
.role-badge.role-director { background: #fef3c7; color: #b45309; }
.role-badge.role-manager { background: #dbeafe; color: #1d4ed8; }

/* Sales ranking table (director dashboard) */
.sales-ranking-card .rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #f3f4f6; }
.sales-ranking-card .rank-row:last-child { border-bottom: none; }
.rank-pos { width: 28px; height: 28px; border-radius: 50%; background: #f3f4f6; color: #374151; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.rank-row.top1 .rank-pos { background: #fde68a; color: #92400e; }
.rank-row.top2 .rank-pos { background: #e5e7eb; color: #374151; }
.rank-row.top3 .rank-pos { background: #fed7aa; color: #9a3412; }
.rank-name { flex: 1; font-weight: 600; color: #111827; }
.rank-meta { color: #6b7280; font-size: 12px; }
.rank-value { text-align: right; }
.rank-value .rv-won { color: #16a34a; font-weight: 700; }
.rank-value .rv-pipe { color: #6b7280; font-size: 12px; }

/* Scope toggle (mine vs team) */
.scope-toggle .btn-check + .btn { font-size: 12px; padding: 4px 12px; }

.dashboard-row { display:block; padding:4px 6px; border-radius:6px; transition:background-color .15s ease; cursor:pointer; }
.dashboard-row:hover { background-color: rgba(99,102,241,0.08); }


.kanban-card { cursor: grab; }
.kanban-card.dragging { opacity:.5; cursor: grabbing; }
.kanban-col.drag-over { background: #e0e7ff; outline: 2px dashed var(--brand); outline-offset: -4px; }
.kanban-col-body { min-height: 40px; }
.kanban-col[data-stage='Cancelled'] { background:#f3f4f6; }


a.stat-card-link { color: inherit; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
a.stat-card-link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15,23,42,.08); border-color: var(--brand); }


/* === Dashboard hero & stat-card accents === */
.hero-card { position: relative; border-radius: 18px; padding: 1.75rem 2rem; color: #fff; overflow: hidden; box-shadow: 0 10px 30px rgba(15,23,42,.10); }
.hero-card .hero-bg { position:absolute; inset:0; background: linear-gradient(135deg,#4f46e5 0%,#6366f1 35%,#8b5cf6 70%,#ec4899 100%); z-index:0; }
.hero-card .hero-bg::after { content:""; position:absolute; inset:0; background: radial-gradient(circle at 90% 0%, rgba(255,255,255,.25) 0%, transparent 45%), radial-gradient(circle at 10% 100%, rgba(255,255,255,.15) 0%, transparent 50%); }
.hero-card .hero-content { position:relative; z-index:1; display:flex; justify-content:space-between; align-items:flex-end; gap:1.5rem; flex-wrap:wrap; }
.hero-card .hero-greet { font-size:.85rem; opacity:.9; letter-spacing:.04em; text-transform:uppercase; margin-bottom:.4rem; }
.hero-card .hero-title { font-size:1.6rem; font-weight:700; margin:0 0 .35rem; color:#fff; }
.hero-card .hero-sub { margin:0; opacity:.92; font-size:.95rem; max-width:62ch; }
.hero-card .hero-meta { display:flex; gap:1.25rem; flex-wrap:wrap; margin-top:1rem; font-size:.85rem; }
.hero-card .hero-meta span { background: rgba(255,255,255,.15); padding:.35rem .7rem; border-radius:999px; backdrop-filter: blur(6px); }
.hero-card .hero-meta strong { color:#fef9c3; }
.hero-card .hero-actions .btn-light { background:#fff; color:#4f46e5; }
.hero-card .hero-actions .btn-outline-light { color:#fff; border-color: rgba(255,255,255,.6); }
.hero-card .hero-actions .btn-outline-light:hover { background: rgba(255,255,255,.15); }

.stat-card { position: relative; overflow: hidden; }
.stat-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background:#cbd5e1; transition: width .15s ease; }
a.stat-card-link:hover::before { width:6px; }
.stat-card .value { font-size:1.55rem; font-weight:700; line-height:1.1; }
.stat-card .label { font-size:.72rem; text-transform:uppercase; letter-spacing:.06em; color: var(--muted); font-weight:600; }
.stat-card .delta { font-size:.78rem; color: var(--muted); margin-top:.15rem; }
.stat-accent-blue::before    { background: linear-gradient(180deg,#6366f1,#3b82f6); }
.stat-accent-green::before   { background: linear-gradient(180deg,#10b981,#059669); }
.stat-accent-amber::before   { background: linear-gradient(180deg,#f59e0b,#d97706); }
.stat-accent-red::before     { background: linear-gradient(180deg,#ef4444,#dc2626); }
.stat-accent-emerald::before { background: linear-gradient(180deg,#34d399,#059669); }
.stat-accent-purple::before  { background: linear-gradient(180deg,#a78bfa,#7c3aed); }
.stat-accent-teal::before    { background: linear-gradient(180deg,#2dd4bf,#0d9488); }
.stat-accent-rose::before    { background: linear-gradient(180deg,#fb7185,#e11d48); }

@media (max-width: 640px) {
  .hero-card { padding: 1.25rem 1.25rem; border-radius: 14px; }
  .hero-card .hero-title { font-size: 1.25rem; }
}
