/* ---------- EasyCRM — Clean modern SaaS look ---------- */
:root {
    --side-w: 244px;
    --brand: #4f46e5;
    --brand-600: #4338ca;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --bg: #f6f8fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

html, body { background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif; }

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--side-w);
    background: #0b1220;
    color: #cbd5e1;
    padding: 20px 12px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-sidebar .brand {
    font-weight: 700; font-size: 1.15rem; color: #fff; padding: 4px 12px 20px;
    display: flex; align-items: center; gap: 8px;
}
.app-sidebar .brand .bi { color: var(--brand); }
.app-sidebar .nav-link {
    color: #cbd5e1; border-radius: 8px; padding: 8px 12px; margin-bottom: 2px;
    font-size: .92rem; display: flex; align-items: center; gap: 10px;
}
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.app-sidebar .nav-link.active { background: var(--brand); color: #fff; }
.app-sidebar .nav-section { color: #64748b; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; margin: 16px 12px 6px; }

.app-main { flex: 1; min-width: 0; }
.app-topbar {
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
}
.app-content { padding: 24px; }

.card { border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; }

.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { 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); }

.table thead th { background: #f8fafc; color: var(--ink-2); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.table td { vertical-align: middle; }

.badge-status { text-transform: capitalize; }
.status-new { background:#e0e7ff; color:#3730a3;}
.status-contacted { background:#dbeafe; color:#1e40af;}
.status-qualified { background:#dcfce7; color:#166534;}
.status-unqualified { background:#fee2e2; color:#991b1b;}
.status-converted { background:#f5d0fe; color:#86198f;}
.status-open{background:#e0e7ff;color:#3730a3;}.status-in_progress{background:#fef3c7;color:#92400e;}
.status-completed{background:#dcfce7;color:#166534;}.status-cancelled{background:#f3f4f6;color:#374151;}
.status-draft{background:#f3f4f6;color:#374151;}.status-sent{background:#dbeafe;color:#1e40af;}
.status-paid{background:#dcfce7;color:#166534;}.status-overdue{background:#fee2e2;color:#991b1b;}

/* KPI cards */
.kpi { border-radius: 12px; padding: 18px 20px; background: #fff; border: 1px solid var(--border); }
.kpi .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 1.7rem; font-weight: 700; margin-top: 6px; }
.kpi .trend { font-size: .8rem; color: var(--success); }

/* Kanban */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: 0 0 300px; background: #eef2f7; border-radius: 12px; padding: 12px; min-height: 60vh; }
.kanban-col h6 { display:flex; align-items:center; justify-content: space-between; margin: 0 0 10px; font-weight: 600; }
.kanban-col h6 .count { background: #fff; border-radius: 20px; padding: 2px 8px; font-size: .75rem; color: var(--muted); }
.kanban-card { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border-left: 3px solid var(--brand); cursor: grab; }
.kanban-card .name { font-weight: 600; font-size: .95rem; }
.kanban-card .meta { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.kanban-card .amount { font-weight: 700; color: var(--brand-600); }
.kanban-card.sortable-ghost { opacity: .3; }
.stage-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* Login */
.install-body, .login-body { background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%); min-height: 100vh; }
.login-card { max-width: 420px; margin: 8vh auto; }

/* Utilities */
.text-muted-2 { color: var(--muted); }
.click-to-call, .send-sms { cursor: pointer; }
.click-to-call:hover { color: var(--brand); }

/* Timeline */
.timeline .tl-item { position: relative; padding: 12px 0 12px 40px; border-left: 2px solid #e5e7eb; margin-left: 12px; }
.timeline .tl-icon { position: absolute; left: -14px; top: 12px; background: #fff; border: 2px solid #e5e7eb; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--brand); }
.timeline .tl-body { background: #f8fafc; border-radius: 8px; padding: 8px 12px; }

/* Mobile */
@media (max-width: 768px) {
    .app-shell { flex-direction: column; }
    .app-sidebar {
        width: 100%; height: auto; position: static;
        padding: 8px 12px; overflow-x: auto; overflow-y: hidden; white-space: nowrap;
    }
    .app-sidebar .brand { padding: 4px 8px 8px; }
    .app-sidebar .nav { flex-direction: row !important; flex-wrap: nowrap; }
    .app-sidebar .nav-link { padding: 6px 10px; font-size: .85rem; }
    .app-sidebar .nav-section { display: none; }
    .app-topbar { padding: 10px 12px; }
    .app-content { padding: 12px; }
    .kanban { padding-bottom: 12px; }
    .kanban-col { flex: 0 0 84vw; }
    .kpi .value { font-size: 1.4rem; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
}

.print-only { display: none; }
@media print {
    .app-sidebar, .app-topbar, .no-print { display: none !important; }
    .app-content { padding: 0; }
    .print-only { display: block; }
}
