:root {
    --bg-app: #f3f6fb;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --text-main: #0f172a;
    --text-muted: #475569;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --border: #cbd5e1;
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    margin: 0;
    padding: 0;
}

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

.crm-sidebar {
    width: 255px;
    background: var(--bg-sidebar);
    color: #f8fafc;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.crm-brand {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #1e293b;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    color: #ffffff;
}

.crm-brand small {
    display: block;
    font-weight: 500;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
}

.crm-nav {
    padding: 0.75rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.crm-nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.15s ease;
}

.crm-nav a:hover, .crm-nav a.active {
    background: #1e293b;
    color: #ffffff;
}

.crm-nav a.active {
    background: var(--primary);
    font-weight: 600;
}

.crm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.crm-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.crm-content {
    padding: 1.25rem;
    max-width: 1480px;
    width: 100%;
    margin: 0 auto;
}

.crm-card {
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.15rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    margin-bottom: 1rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.kpi-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--primary);
    border-radius: 0.65rem;
    padding: 0.85rem 1rem;
}

.kpi-box.warn { border-left-color: #f59e0b; }
.kpi-box.danger { border-left-color: #ef4444; }
.kpi-box.success { border-left-color: #10b981; }

.kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a;
}

.kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.stage-pill {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    background: #dbeafe;
    color: #1e40af;
}

.stage-pill.signed {
    background: #dcfce7;
    color: #166534;
}

.stage-pill.warn {
    background: #fef3c7;
    color: #92400e;
}

.stage-pill.danger {
    background: #fee2e2;
    color: #991b1b;
}

.sticky-action-bar {
    position: sticky;
    top: 54px;
    z-index: 30;
    background: #0f172a;
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 0.65rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.field-checkbox {
    width: 1.45rem;
    height: 1.45rem;
    cursor: pointer;
    accent-color: var(--primary);
}

.kanban-board {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
}

.kanban-col {
    min-width: 280px;
    max-width: 310px;
    background: #e2e8f0;
    border-radius: 0.65rem;
    padding: 0.75rem;
    flex-shrink: 0;
}

.kanban-card {
    background: #ffffff;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.6rem;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

@media (max-width: 900px) {
    .crm-shell {
        flex-direction: column;
    }
    .crm-sidebar {
        width: 100%;
    }
    .crm-nav {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding: 0.5rem;
    }
}
