/* Pipely — modern SaaS design system */

:root {
    --bg: #f7f7fb;
    --surface: #ffffff;
    --surface-2: #f1f1f8;
    --border: #e5e5f0;
    --text: #18181f;
    --text-dim: #74748a;
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-dim: #eef0fe;
    --ok: #16a34a;
    --ok-dim: #dcfce7;
    --warn: #d97706;
    --warn-dim: #fef3c7;
    --danger: #e11d48;
    --danger-dim: #ffe4e9;
    --blue: #2563eb;
    --blue-dim: #dbeafe;
    --slate-dim: #eef0f3;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(24,24,31,.06), 0 1px 2px rgba(24,24,31,.04);
    --shadow-lift: 0 20px 45px rgba(24,24,31,.14);
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 14.5px;
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }

/* ---------- Layout: light top navbar + horizontal tabs ---------- */

.crm-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
}

.crm-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 16.5px;
}

.crm-brand .brand-mark {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.crm-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.crm-user-chip .avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12.5px;
}

.crm-user-chip a.logout { color: var(--text-dim); font-size: 15px; }
.crm-user-chip a.logout:hover { color: var(--danger); }

.crm-tabs {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 4px;
    padding: 0 24px;
    overflow-x: auto;
}

.crm-tabs a {
    padding: 12px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.crm-tabs a:hover { color: var(--text); }
.crm-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

.crm-content { max-width: 1280px; margin: 0 auto; padding: 26px 24px 60px; }

.crm-nav-toggle { display: none; }

/* ---------- Stat cards ---------- */

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: -0.02em;
}

.stat-card .stat-value.c-accent { color: var(--accent); }
.stat-card .stat-value.c-ok { color: var(--ok); }
.stat-card .stat-value.c-warn { color: var(--warn); }

/* ---------- Panels ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
}

.panel-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-head h3 { font-size: 15px; margin: 0; }
.panel-body { padding: 20px; }
.panel-body.p-0 { padding: 0; }

/* ---------- Table ---------- */

.crm-table { width: 100%; border-collapse: collapse; }

.crm-table thead th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    font-weight: 700;
    padding: 10px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.crm-table tbody td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}

.crm-table tbody tr:last-child td { border-bottom: none; }
.crm-table tbody tr:hover { background: var(--surface-2); }

/* ---------- Pills ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 700;
}

.pill-slate  { background: var(--slate-dim); color: #475569; }
.pill-blue   { background: var(--blue-dim);  color: var(--blue); }
.pill-violet { background: var(--accent-dim);color: var(--accent); }
.pill-amber  { background: var(--warn-dim);  color: #b45309; }
.pill-green  { background: var(--ok-dim);    color: #15803d; }
.pill-red    { background: var(--danger-dim);color: var(--danger); }

/* ---------- Buttons ---------- */

.btn-crm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-crm:hover { background: #4f46e5; color: #fff; }

.btn-crm-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
}

.btn-crm-outline:hover { background: var(--surface-2); color: var(--text); }
.btn-crm-outline.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }

.btn-crm-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }

.btn-icon-crm {
    width: 30px; height: 30px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-icon-crm:hover { background: var(--accent-dim); color: var(--accent); }

/* ---------- Forms ---------- */

.form-label { font-weight: 600; font-size: 12.5px; color: var(--text); margin-bottom: 5px; }

.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 13px;
    font-size: 13.5px;
    background: var(--surface);
    color: var(--text);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ---------- Kanban board ---------- */

.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.kanban-col {
    flex: 0 0 268px;
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 200px;
}

.kanban-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 10px;
}

.kanban-col-head .kc-title {
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.kanban-col-head .kc-count {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    color: var(--text-dim);
}

.kanban-col.drag-over { background: var(--accent-dim); }

.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 13px;
    margin-bottom: 10px;
    cursor: grab;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.kanban-card:hover { box-shadow: var(--shadow-lift); }
.kanban-card.dragging { opacity: 0.4; }

.kanban-card .kc-name { font-weight: 700; font-size: 13.5px; }
.kanban-card .kc-company { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.kanban-card .kc-value { font-size: 12.5px; font-weight: 700; color: var(--accent); margin-top: 8px; }
.kanban-card .kc-followup { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

/* ---------- Activity timeline ---------- */

.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-item .a-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.activity-item .a-desc { font-size: 13px; }
.activity-item .a-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

/* ---------- Auth pages ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #eef0fe 0%, #f7f7fb 55%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
    overflow: hidden;
    border: 1px solid var(--border);
}

.auth-card-top { text-align: center; padding: 36px 30px 22px; }

.auth-logo {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 14px;
}

.auth-card-top h1 { font-size: 22px; margin: 0; }
.auth-card-top p { color: var(--text-dim); font-size: 13px; margin: 4px 0 0; font-weight: 500; }
.auth-card-body { padding: 10px 30px 32px; }

/* ---------- Misc ---------- */

.fs-13 { font-size: 13px; }
.text-dim { color: var(--text-dim); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-dim); }
.empty-state i { font-size: 30px; color: var(--border); margin-bottom: 12px; }

@media (max-width: 700px) {
    .crm-content { padding: 18px 14px 40px; }
    .kanban-col { flex: 0 0 240px; }
}
